Skip to content

Commit

Permalink
juledoc: update and fix group documentation line handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jan 17, 2025
1 parent b172f81 commit 8afe4d2
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions gen/markdown/markdown.jule
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ impl gen {
match type ctx.Node {
| doc::Separator:
if *group != 0 {
self.out.WriteStr("\n```\n")!
*group = 0
self.out.WriteStr("\n")!
} else {
self.out.WriteStr("\n\n")!
indent = 0
}
indent = 0
lastIsListItem = false
lastIsSeparator = true
continue
Expand All @@ -74,8 +73,15 @@ impl gen {
*group = ctx.Indent
self.out.WriteStr("```\n")!
} else if *group != 0 {
self.out.WriteStr("\n")!
self.out.WriteStr(strings::Repeat("\t", ctx.Indent-*group))!
// Indentation is lower than group indentation.
// This is end fo the group.
if *group > ctx.Indent {
self.out.WriteStr("\n```\n")!
*group = 0
} else {
self.out.WriteStr("\n")!
self.out.WriteStr(strings::Repeat("\t", ctx.Indent-*group))!
}
}
txt := doc::Text(ctx.Node)
writeDocText(str(txt))
Expand All @@ -88,8 +94,15 @@ impl gen {
self.out.WriteStr("<br>\n\n")!
}
} else if *group != 0 {
self.out.WriteStr("\n")!
self.out.WriteStr(strings::Repeat("\t", ctx.Indent-*group))!
// Indentation is lower than group indentation.
// This is end fo the group.
if *group > ctx.Indent {
self.out.WriteStr("\n```\n")!
*group = 0
} else {
self.out.WriteStr("\n")!
self.out.WriteStr(strings::Repeat("\t", ctx.Indent-*group))!
}
}
self.out.WriteStr("- ")!
txt := doc::ListItem(ctx.Node)
Expand Down

0 comments on commit 8afe4d2

Please sign in to comment.