diff --git a/main.go b/main.go index d202e32..738e79a 100644 --- a/main.go +++ b/main.go @@ -97,34 +97,6 @@ func (n *Node) addChild(child *Node) { n.Children = append(n.Children, child) } -func writeHTML(n *Node) { - os.Chdir("content") - f, err := os.Create(n.Data.Id + ".html") - if err != nil { - log.Fatalf("Error creating file for ID %v", n.Data.Id) - } - defer f.Close() - log.Printf("Writing file %v containing page: %v", f.Name(), n.Data.Title) - html := ` - - - - - - - - -
` - html += "

" + n.Data.Title + "

" - html += n.Data.Body - html += "
" - html = fixHTML(html) - _, err = f.Write([]byte(html)) - if err != nil { - log.Fatalf("Error writing file for ID %v", n.Data.Id) - } -} - type spaceResult struct { Results []struct { ID string `json:"id"` @@ -306,6 +278,34 @@ type attachmentResult struct { } `json:"_links"` } +func writeHTML(n *Node) { + os.Chdir("content") + f, err := os.Create(n.Data.Id + ".html") + if err != nil { + log.Fatalf("Error creating file for ID %v", n.Data.Id) + } + defer f.Close() + log.Printf("Writing file %v containing page: %v", f.Name(), n.Data.Title) + html := ` + + + + + + + + +
` + html += "

" + n.Data.Title + "

" + html += n.Data.Body + html += "
" + html = fixHTML(html) + _, err = f.Write([]byte(html)) + if err != nil { + log.Fatalf("Error writing file for ID %v", n.Data.Id) + } +} + func getRequest(args Arguments, url string) ([]byte, error) { b64Auth := base64.StdEncoding.EncodeToString([]byte(args.User + ":" + args.Token)) client := &http.Client{} @@ -379,14 +379,6 @@ func downloadAttachmentsForPage(args Arguments, page *Node) { log.Fatalf("Failed to write file: %v", err) } } - - // TODO polish html, replace img attachment links, table styling - // in html müssen die href zu den files geändert werden - // href order img class - // data-linked-resource-type="attachment" - // data-linked-resource-default-alias="image-20210609-123740.png" - // example with image: ROBODEVOPS/pages/3036938774.html - // example with href: ROBODEVOPS/pages/2165571587.html } func createPageTree(s *spaceResult) *Node {