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=" -

Sections

- +.sections a:hover, .sections a:focus, .sections a:active { background: rgba(200, 200, 200, 0.2); }" + +org_files=org/testdata/*.org +go_org_examples=" +

Sections

+
" for org_file in $org_files; do echo generating content for $org_file name=$(basename $org_file) - examples+=" + go_org_examples+="

${name}

$(sed '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+=" +

${name}

+
+
$(./gh-pages/goorgeous $org_file)
+
$(./go-org $org_file html-chroma)
+
" +done +go_org_vs_goorgeous_examples+="" +rm gh-pages/goorgeous gh-pages/goorgeous.go + echo "$index" > gh-pages/index.html echo "$convert" > gh-pages/convert.html +echo "$go_org_vs_goorgeous_examples" > gh-pages/go-org-vs-goorgeous.html cp etc/_wasm.go gh-pages/wasm.go GOOS=js GOARCH=wasm go build -o gh-pages/main.wasm gh-pages/wasm.go rm gh-pages/wasm.go