1
0
mirror of https://github.com/danog/blackfriday.git synced 2024-11-30 04:29:13 +01:00
Commit Graph

25 Commits

Author SHA1 Message Date
Tom Payne
d96905437e Add Node.IsLeaf 2019-04-23 22:12:31 +02:00
Tom Payne
b98aa06008 Export Node.IsContainer 2019-04-23 22:10:42 +02:00
Vytautas Šaltenis
747587a52d Fix all headings wrongly referred to as headers
I've left test cases alone since can't lean on the compiler for
crosschecking there.

Fixes #330.
2017-02-12 19:05:30 +02:00
Pierre Neidhardt
14a0c487b8 Fix walk with non-container root nodes
When passed a non-container root node, the former algorithm would go on
walking down the rest of the tree beyond the root.

The former walk fix was supposed to do that but somehow the code
disappeared in the process.
2016-10-05 11:04:51 +05:30
Vytautas Šaltenis
1aa82c4039 Make golint happy: fix method receiver
golint insists on uniform receiver names.
2016-09-17 19:36:55 +03:00
Vytautas Šaltenis
8a11177489 Add direct link to a footnote from it's referer
Some renderers might not care to have an explicit list of footnotes at
the end of the document, instead they're interested in the content of
the footnote at the location of a referer. Make their lives easier by
providing such a link
2016-09-17 19:35:42 +03:00
Vytautas Šaltenis
6947216efb Move footnote rendering to the renderer
Clean up footnotes part of an AST: don't force HTML-specific pieces
there, just keep a clean list of footnotes. Since some renderers might
want to process footnotes differently, let them know about footnotes by
having a flag on that list.
2016-09-03 12:39:16 +03:00
Pierre Neidhardt
fdbedcdb78 Export tree manipulation functions 2016-08-10 08:59:15 +05:30
Pierre Neidhardt
ff2d79c2cb Fix walk so that it does not step outside the root node
When passed a non-container root node, or when the visitor whould return
SkipChildren for the root node, the former algorithm would go on walking
down the rest of the tree beyond the root.

This commit also removes unneeded functions and variables.
2016-08-03 15:06:49 +05:30
Vytautas Šaltenis
72633fddee Lint node.go 2016-07-27 21:04:20 +03:00
Vytautas Šaltenis
a4f1e5c786 Limit Node.String() to print itself, no children 2016-07-27 09:44:24 +03:00
Pierre Neidhardt
37ffc1c86a Make Node satisfy the Stringer interface
It allows for printing AST dumps in external code
2016-07-01 17:23:30 +02:00
Vytautas Šaltenis
c9ea588e6f Convert uint32 fields to ints
The former is a bit too inconvenient despite being more accurate.
2016-04-11 11:15:15 +03:00
Vytautas Šaltenis
9da90c5929 Allow NodeVisitor to have some control over traversal
Make NodeVisitor return status and decide upon it which node to go to
next. So far, this allows to skip subtrees and quit early.
2016-04-05 12:48:28 +03:00
Vytautas Šaltenis
e7d45749ff Give node visitor callback type a name and docs 2016-04-05 12:48:28 +03:00
Vytautas Šaltenis
d7f18785f1 Implement TOC and OmitContents
Move these two flags from HTML renderer's flags to extensions. Implement
both since they were not yet implemented in the AST rewrite. Add tests.

Note: the expected test strings differ very slightly from v1. The HTML
produced by v2 has a few extra newlines compared to the old one, but
it's now uniform with other sections of the generated document. If the
newline placement gets cleaned up in the future, this will get fixed
automatically, since the renderer is agnostic about the TOC list.
2016-04-04 12:04:20 +03:00
Vytautas Šaltenis
02a5ce37ff Go style: Html{Block|Span} -> HTML{Block|Span} 2016-04-01 13:15:47 +03:00
Vytautas Šaltenis
f1361aa0da Make ForEachNode func a Walk method on Node 2016-04-01 12:36:56 +03:00
Vytautas Šaltenis
04673c9f28 Improve documentation for Node struct 2016-04-01 12:33:05 +03:00
Vytautas Šaltenis
8a4d4fa0cd Move Header-related fields to a nested struct 2016-04-01 11:48:52 +03:00
Vytautas Šaltenis
bcd5b5b780 Move table cell fields to a nested struct 2016-04-01 11:46:09 +03:00
Vytautas Šaltenis
4ba991937b Store cell alignment in own type instead of int 2016-04-01 11:44:59 +03:00
Vytautas Šaltenis
67f85cf540 Move code block fields to a nested struct 2016-04-01 11:29:15 +03:00
Vytautas Šaltenis
60026cc3c6 Make ListData a nested struct instead of pointer 2016-04-01 11:21:25 +03:00
Vytautas Šaltenis
2bbed304fb Add AST data structures
The main Node structure that holds every AST node and some supplementary
substructs. A bit of helper code to handle the nodes.
2016-03-30 12:54:12 +03:00