File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,6 @@ import (
1111 "strings"
1212)
1313
14- // GHToc GitHub TOC
15- type GHToc []string
16-
1714// Print TOC to the console
1815func (toc * GHToc ) Print (w io.Writer ) error {
1916 for _ , tocItem := range * toc {
@@ -103,16 +100,21 @@ func (doc *GHDoc) Convert2HTML() error {
103100 doc .d ("Convert2HTML: start." )
104101 defer doc .d ("Convert2HTML: done." )
105102
103+ // remote file may be of 2 types:
104+ // - raw md file (we need to download it locally and convert t HTML)
105+ // - html file (we need just to load it and parse TOC from it)
106106 if doc .IsRemoteFile () {
107107 htmlBody , ContentType , err := doc .httpGetter (doc .Path )
108108 doc .d ("Convert2HTML: remote file. content-type: " + ContentType )
109109 if err != nil {
110+ doc .d ("Convert2HTML: err=" + err .Error ())
110111 return err
111112 }
112113
113114 // if not a plain text - return the result (should be html)
114115 if strings .Split (ContentType , ";" )[0 ] != "text/plain" {
115116 doc .html = string (htmlBody )
117+ doc .d ("Convert2HTML: not a plain text, body" + string (htmlBody )[:200 ])
116118 return nil
117119 }
118120
Original file line number Diff line number Diff line change 1+ package ghtoc
2+
3+ // GHToc GitHub TOC
4+ type GHToc []string
You can’t perform that action at this time.
0 commit comments