diff --git a/etc/_goorgeous.go b/etc/_goorgeous.go new file mode 100644 index 0000000..b2069b7 --- /dev/null +++ b/etc/_goorgeous.go @@ -0,0 +1,34 @@ +package main + +import ( + "io/ioutil" + "log" + "os" + + "github.com/chaseadamsio/goorgeous" + "github.com/russross/blackfriday" +) + +func main() { + defer func() { + if err := recover(); err != nil { + log.Print(err) + } + }() + log.SetFlags(0) + log.SetOutput(os.Stdout) + + path := os.Args[1] + in, err := ioutil.ReadFile(path) + if err != nil { + log.Fatal(err) + } + + flags := blackfriday.HTML_USE_XHTML + flags |= blackfriday.LIST_ITEM_BEGINNING_OF_LIST + flags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS + parameters := blackfriday.HtmlRendererParameters{} + parameters.FootnoteReturnLinkContents = "↩" + renderer := blackfriday.HtmlRendererWithParameters(flags, "", "", parameters) + log.Print(string(goorgeous.Org(in, renderer))) +} diff --git a/etc/generate-gh-pages b/etc/generate-gh-pages index ed613e5..34a587e 100755 --- a/etc/generate-gh-pages +++ b/etc/generate-gh-pages @@ -1,24 +1,35 @@ #!/bin/bash -org_files=org/testdata/*.org -examples=" -
$(sed 's/&/\&/g; s/\</g; s/>/\>/g;' $org_file)@@ -91,21 +102,10 @@ convert=" index=" - $convert - $examples + $go_org_examples " @@ -120,8 +120,33 @@ convert=" " mkdir -p gh-pages +go get github.com/chaseadamsio/goorgeous +cp etc/_goorgeous.go gh-pages/goorgeous.go +go build -o gh-pages/goorgeous gh-pages/goorgeous.go +go_org_vs_goorgeous_examples=" + + + + " +for org_file in $org_files; do + echo generating content for $org_file + name=$(basename $org_file) + go_org_vs_goorgeous_examples+=" +