terminate content with new line

explicit option to show citation markers
increment version
output embedded images as links
This commit is contained in:
Luke Emmet 2020-08-25 22:39:30 +01:00
parent 81227fa2fb
commit a29cb7bd9a
2 changed files with 17 additions and 3 deletions

View File

@ -11,6 +11,7 @@ html2gmi <flags>
-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

View File

@ -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)