Fix some markdown output issues

This commit is contained in:
r4 2021-07-19 21:31:34 +02:00
parent 72915c2de7
commit f309c62d5a
2 changed files with 6 additions and 3 deletions

5
go.mod
View File

@ -2,4 +2,7 @@ module projekt_gutenberg_de_dl
go 1.16 go 1.16
require github.com/PuerkitoBio/goquery v1.7.1 require (
github.com/PuerkitoBio/goquery v1.7.1
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
)

View File

@ -241,7 +241,7 @@ func (e *Extractor) parseAdditionalPage(doc *gq.Document) error {
// Transform the individual HTML elements. // Transform the individual HTML elements.
switch n.DataAtom { switch n.DataAtom {
case atom.Br: case atom.Br:
ret = "\n" ret = "\n\n"
case atom.H1: case atom.H1:
ret = "# " + processChildren() + "\n" ret = "# " + processChildren() + "\n"
case atom.H2: case atom.H2:
@ -318,7 +318,7 @@ func (e *Extractor) FetchAndProcessChapter(chapterUrl string) error {
} }
// Add horizontal rule after title page. // Add horizontal rule after title page.
if path.Base(chapterUrl) == "titlepage.html" { if path.Base(chapterUrl) == "titlepage.html" {
fmt.Fprintln(e.W, "----------------") fmt.Fprintln(e.W, "\n----------------\n")
} }
return nil return nil
} }