Commit Graph

419 Commits

Author SHA1 Message Date
Vytautas Šaltenis e7d45749ff Give node visitor callback type a name and docs 2016-04-05 12:48:28 +03:00
Vytautas Šaltenis 76062d428d Fixup broken test reporting
Dereference the pointer introduced in f35fae8.
2016-04-05 12:48:20 +03:00
Vytautas Šaltenis 6bd31203b1 Add test for UseXHTML 2016-04-05 09:51:46 +03:00
Vytautas Šaltenis 106f1ec1bb Add test for CompletePage flag
The implementation for CompletePage was committed with d7f1878 by
accident, following up with the test.
2016-04-04 14:17:16 +03:00
Vytautas Šaltenis 607478a8ce Implement SkipLinks, add test 2016-04-04 14:08:35 +03:00
Vytautas Šaltenis 0774c060d7 Get rid of unnecessary test helpers 2016-04-04 14:00:26 +03:00
Vytautas Šaltenis f35fae8188 Extract panic recovery code
Call recover() in a single place so it could be easily turned off when
not needed.
2016-04-04 13:13:57 +03:00
Vytautas Šaltenis f1fd3a6412 Do away with doTestsInlineParam
What used to be doTestsBlockWithRunner is now renamed to
doTestsWithRunner and is good for both block and inline tests.
2016-04-04 12:18:06 +03:00
Vytautas Šaltenis 0c7120d6dc Fix old omission in doTestsBlockWithRunner
It calls the provided runner in the -short run, but the standard runner
in the complete run. Fix that.
2016-04-04 12:09:36 +03:00
Vytautas Šaltenis a658caacc6 Use TestParams in block tests
The different testing function interfaces get unified a bit closer,
runnerWithRendererParameters completely eliminated.
2016-04-04 12:04:20 +03:00
Vytautas Šaltenis b069de6276 Wrap inline test parameters in a struct
Take advantage of zero value initialization.
2016-04-04 12:04:20 +03:00
Vytautas Šaltenis 15e052e478 Move all testing helper funcs in one place
Moved verbatim except for uncommented panic recovery section in the
doTestsInlineParam function.
2016-04-04 12:04:20 +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 0b69796248 Go style: more Html -> HTML renames 2016-04-01 15:37:21 +03:00
Vytautas Šaltenis 02a5ce37ff Go style: Html{Block|Span} -> HTML{Block|Span} 2016-04-01 13:15:47 +03:00
Vytautas Šaltenis 32802dbae5 Go style: rename Toc to TOC 2016-04-01 13:12:38 +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 c8eb73377e Fix typos 2016-04-01 11:22:13 +03:00
Vytautas Šaltenis 60026cc3c6 Make ListData a nested struct instead of pointer 2016-04-01 11:21:25 +03:00
Vytautas Šaltenis 2a07386455 Rename HtmlFlags to HTMLFlags to adhere to Go style 2016-04-01 10:49:23 +03:00
Vytautas Šaltenis 71fe9a191e Remove dead code 2016-04-01 10:48:25 +03:00
Vytautas Šaltenis a55b2615a4 Run Smartypants as a separate pass over the AST
Separate Smartypants somewhat from the HTML renderer. Move its flags
from HtmlFlags to Extensions (probably should be moved to its own set of
flags, but not now). With that done, do a separate walk of the tree and
either run Smartypants processor if it's enabled, or simply escape text
nodes.
2016-04-01 10:44:22 +03:00
Vytautas Šaltenis 7869a127bd Combine two Smartypants structs into one
Combine smartypantsRenderer and smartypantsData into one struct. Make
action funcs methods on that struct.
2016-03-31 21:40:37 +03:00
Vytautas Šaltenis 4a7ff562a7 Rename Html to HTML to adhere to Go style 2016-03-31 13:54:09 +03:00
Vytautas Šaltenis fd2d69de5e Make renderer write to an explicit io.Writer 2016-03-30 21:13:02 +03:00
Vytautas Šaltenis 4c11a2a62d Expose Parse func that grabs input and returns AST 2016-03-30 19:40:10 +03:00
Vytautas Šaltenis c1011c8ab2 Remove unneeded reference to Renderer from parser 2016-03-30 19:35:53 +03:00
Vytautas Šaltenis 4d74c6a071 Make common flags and extensions public
Add DefaultOptions convenience variable.
2016-03-30 19:29:00 +03:00
Vytautas Šaltenis dc7d4b68df Remove some cruft 2016-03-30 15:56:53 +03:00
Vytautas Šaltenis 0382dab0c3 The single node renderer is a separate func now
A default HTML renderer for a single node is now easily accessible.
Makes it easy to fall back to the default behavior when writing custom
HTML renderers.
2016-03-30 15:48:43 +03:00
Vytautas Šaltenis 886a1405c0 Extract local funcs/vars into methods/members 2016-03-30 15:37:03 +03:00
Vytautas Šaltenis 6fe811b603 Fix TitleBlock test
It seems like the implementation of the extension was rather sloppy and
didn't adhere to the style common to the rest of Blackfriday.
2016-03-30 15:05:24 +03:00
Vytautas Šaltenis a32ecdb83d Fix footnote tests
This commit does some changes to the test suite. The changes are only to
the newlines. Turns out the former implementation of footnotes produced
slightly different spacing when rendering the footnotes list. The new
implementation produces the list that is compatible with the rest of the
package.
2016-03-30 15:03:11 +03:00
Vytautas Šaltenis 70124f1ea3 Enable full AST construction, use the new renderer
Connect the block and inline parsers. Most of the tests now pass, only a
couple fail, they need fixes in the test suite.
2016-03-30 14:47:30 +03:00
Vytautas Šaltenis eb70b23221 Construct AST WIP: add inline-level nodes
Parse the content of the block nodes for inline markdown, decorate the
tree with what's found. Tests still broken, need to connect the dots.
2016-03-30 14:38:19 +03:00
Vytautas Šaltenis 7c95b7a189 Construct AST WIP: add block-level nodes
Build a partial tree by adding block nodes. The block nodes will then be
traversed and inline markdown parsed inside each of them. Tests are
broken at this point until the full tree is constructed.
2016-03-30 12:57:12 +03:00
Vytautas Šaltenis 94893247d1 Add a new renderer from AST
This is the new renderer that walks AST and renders everything to a
buffer. Completely covers all the functionality of the previous renderer
and will likely replace it.
2016-03-30 12:54:12 +03:00
Vytautas Šaltenis 7846a310ea Remove unused code 2016-03-30 12:54:12 +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
Vytautas Šaltenis f8378658c0 Fix rendering of tables
Add proper capture groups to fix the order of bits and pieces.
2015-11-10 21:36:32 +02:00
Vytautas Šaltenis d1b544e278 HACK: render TOC the old way, backup and truncate output 2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 97235182ac Enable writing plain text straight to output
It's only used in a single place and should probably be refactored away,
but this workaround is OK for now.
2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 114d6b0d68 Eradicate 'out' parameter in top level code 2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 0dfcd3beb5 Remove all uses of 'out' in Latex renderer 2015-11-10 21:36:32 +02:00
Vytautas Šaltenis 7a97ffe689 Remove almost all uses of 'out' in HTML renderer 2015-11-10 21:36:32 +02:00