File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ type Config struct {
1212 InputURL string
1313 OutputURL string
1414 Template * template.Template
15+ OnlyInnerHTML bool
1516}
Original file line number Diff line number Diff line change @@ -31,7 +31,13 @@ func parseHtml(config Config) error {
3131 s .SetAttr ("src" , sha )
3232 })
3333
34- html , err := doc .Html ()
34+ var toExport * goquery.Selection
35+ if config .OnlyInnerHTML {
36+ toExport = doc .Find ("body" )
37+ } else {
38+ toExport = doc .Selection
39+ }
40+ html , err := toExport .Html ()
3541 if err != nil {
3642 log .Println ("failed generating output html:" , err )
3743 return err
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ func main() {
1515 var inputUrl = flag .String ("inurl" , "eqn://" , "input webtex URL prefix" )
1616 var outputUrl = flag .String ("outurl" , "equations" , "image src root" )
1717 var templateFilename = flag .String ("template" , "" , "TeX template file" )
18+ var onlyInner = flag .Bool ("innerhtml" , false , "export only inner HTML of the result (without <html><body> tags)" )
1819 flag .Parse ()
1920
2021 var err error
@@ -41,6 +42,7 @@ func main() {
4142 config .EquationDirectory = * equationDirectory
4243 config .InputURL = * inputUrl
4344 config .OutputURL = * outputUrl
45+ config .OnlyInnerHTML = * onlyInner
4446
4547 if * templateFilename == "" {
4648 log .Println ("please provide a template file." )
You can’t perform that action at this time.
0 commit comments