From a29cb7bd9a96ba86105ca5ad092e8e948d85d578 Mon Sep 17 00:00:00 2001 From: Luke Emmet Date: Tue, 25 Aug 2020 22:39:30 +0100 Subject: [PATCH] terminate content with new line explicit option to show citation markers increment version output embedded images as links --- README.md | 1 + html2gmi.go | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 255ea32..6b19cc4 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ html2gmi -c, --citationStart int Start citations from this index (default 1) -i, --input string Input path. Otherwise uses stdin -l, --linkEmitFrequency int Emit gathered links through the document after this number of paragraphs (default 2) + -m --citationMarkers Output citation style markers -o, --output string Output path. Otherwise uses stdout -v, --version Find out what version of html2gmi you're running diff --git a/html2gmi.go b/html2gmi.go index 548e9e7..1bfb69c 100644 --- a/html2gmi.go +++ b/html2gmi.go @@ -11,12 +11,13 @@ import ( "os" ) -var version = "0.2.1" +var version = "0.2.2" var ( output = flag.StringP("output", "o", "", "Output path. Otherwise uses stdout") input = flag.StringP("input", "i", "", "Input path. Otherwise uses stdin") citationStart = flag.IntP("citationStart", "c", 1, "Start citations from this index") + citationMarkers = flag.BoolP("citationMarkers", "m", false, "Use footnote style citation markers") linkEmitFrequency = flag.IntP("linkEmitFrequency", "l", 2, "Emit gathered links through the document after this number of paragraphs") verFlag = flag.BoolP("version", "v", false, "Find out what version of html2gmi you're running") ) @@ -92,13 +93,25 @@ func main() { options.PrettyTables = true options.CitationStart = *citationStart options.LinkEmitFrequency = *linkEmitFrequency - + options.CitationMarkers = *citationMarkers + + //use slightly nicer Unicode borders, otherwise can use +,|,- + options.PrettyTablesOptions.CenterSeparator = "┼" + options.PrettyTablesOptions.ColumnSeparator = "│" + options.PrettyTablesOptions.RowSeparator = "─" + + //dont use an extra line to separate header from body, but + //do separate each row visually + options.PrettyTablesOptions.HeaderLine = false + options.PrettyTablesOptions.RowLine = true + text, err := html2gemini.FromString(inputHtml, *options) + check(err) //process the output if *output == "" { - fmt.Print(text) + fmt.Print(text + "\n") //terminate with a new line } else { //save to the specified output gmiBytes := []byte(text)