Skip to content

Commit

Permalink
<div> is regarded as a newline
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmart committed Jan 8, 2023
1 parent 304d86f commit 5d75d45
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions everorg.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var (
attFolderExt = "-attachments"
attachmentPath = ""

isMerged bool
isMerged, rgrdDiv bool
)

// Get Attributes for html tag
Expand Down Expand Up @@ -141,12 +141,15 @@ func (nodes Nodes) orgFormat() string {
header++

// These tags are ignored
case "div", "span", "tr", "tbody", "abbr", "th", "thead", "ins", "img":
case "span", "tr", "tbody", "abbr", "th", "thead", "ins", "img":
break
case "sup", "sub", "small", "br", "dl", "dd", "dt", "font", "colgroup", "cite":
break
case "address", "s", "map", "area", "center", "q":
break
// only the end tag is regarded
case "div":
break

case "hr":
value.WriteString("\n------\n")
Expand Down Expand Up @@ -218,7 +221,10 @@ func (nodes Nodes) orgFormat() string {
value.WriteString("\n#+END_SRC\n")
case "blockquote":
value.WriteString("\n#+END_QUOTE\n")

case "div":
if rgrdDiv && table == 0 {
value.WriteString("\n")
}
}
}
value.WriteString(node.Text)
Expand Down Expand Up @@ -271,6 +277,7 @@ func main() {
wordPtr := flag.String("input", "enex File", "relative path to enex file")

flag.BoolVar(&isMerged, "merge", false, "whether to merge notes to single file")
flag.BoolVar(&rgrdDiv, "regardDiv", false, "closing <div> will become newline")
flag.Parse()
if wordPtr == nil || *wordPtr == "" {
panic("input file is missing")
Expand Down

0 comments on commit 5d75d45

Please sign in to comment.