617 Commits

Author SHA1 Message Date
Dmitri Shuralyov
b88a9bd458 Avoid unneeded break statement.
This is purely a style change with no behavior difference.

In Go (unlike most other languages), case statements in a switch
don't need an explicit break statement, it happens by default. Adding
it explicitly is possible, but has no effect.

In this case, having the break statement hurts readability because
it's hard to tell if it's a mistake, and the break was intended to
break out of the outer for loop, rather than do nothing for the switch
statement. So, remove it, to make it more clear that there is no
bug here.
2016-05-24 22:04:36 -07:00
Vytautas Šaltenis
2004188462 Merge pull request #264 from moorereason/iss263
Fix definition lists that contain other lists
2016-05-10 22:09:22 +03:00
Cameron Moore
acc07e6144 Fix definition lists that contain other lists
Fixes #263
2016-05-06 13:27:55 -05:00
Vytautas Šaltenis
43529be397 Merge pull request #261 from moorereason/iss235
Fix adjacent list merging
2016-05-02 20:28:48 +03:00
Cameron Moore
0529888f55 Fix adjacent list merging
Prevent adjacent lists of differing types from being merged into a
single list.  No options are provided to enable the previous behavior.

Fixes #235
2016-05-02 09:02:35 -05:00
Dmitri Shuralyov
fc997ac2ba Travis: Run gofmt -s, go vet, go test -race, add Go 1.6.
Also make tip a fast-finish allowed failure. That way, if CI fails on
tip due to a temporary issue with tip, it will not break build status.
However, it's still possible to see tip build status by looking at CI
details page.

Do not run go vet with Go 1.4 or older since it's not included in the
standard library, and it's no longer available in external standard
library.

Add godoc badge to README.md.
2016-04-28 22:47:04 -07:00
Vytautas Šaltenis
151efb040f Merge pull request #250 from tomkwok/master
Fix regession: index out of range panic in reference link (#172, #173)
2016-04-21 11:09:30 +03:00
Vytautas Šaltenis
3575453f08 Move a couple helpers to parser where they're used 2016-04-11 15:55:50 +03:00
Vytautas Šaltenis
76d8c71d70 Unduplicate attrEscape funcs 2016-04-11 15:55:50 +03:00
Vytautas Šaltenis
e95d23065a Rename HTML to HTMLRenderer 2016-04-11 11:45:40 +03:00
Vytautas Šaltenis
c26fdef40e Move html entity regexp to where it's used
And unify regexp variable names.
2016-04-11 11:45:19 +03:00
Vytautas Šaltenis
c207eca993 Clean up Renderer interface: remove all callbacks
We now expose the structure of the document in the form of AST, there's
no longer need to have all those callbacks to represent structure.
2016-04-11 11:22:38 +03: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
98ddf98997 Get rid of unneeded method in Renderer 2016-04-11 11:12:41 +03:00
Vytautas Šaltenis
24e146a727 Make HTMLRendererParameters a substruct of HTML 2016-04-05 14:44:14 +03:00
Vytautas Šaltenis
9f5de868aa Go style: take advantage of zero value init 2016-04-05 14:34:30 +03:00
Vytautas Šaltenis
1303ea1427 Cleanup renderer constructors
Move all parameters under HTMLRendererParameters struct, rename
constructors to New{HTML|Latex}Renderer.
2016-04-05 14:24:27 +03:00
Vytautas Šaltenis
4f8d2881a2 Remove a bit of cruft from HTML renderer 2016-04-05 13:54:57 +03:00
Vytautas Šaltenis
123179b8f3 Make Markdown the most general API call
Get rid of MarkdownOptions.
2016-04-05 13:45:00 +03:00
Vytautas Šaltenis
83b4cb6062 Implement SkipHTML, add test 2016-04-05 12:48:29 +03:00
Vytautas Šaltenis
7e9a57463f Implement SkipStyle, add test
Fix a bug in findHtmlTagPos introduced with e02c392d.
2016-04-05 12:48:28 +03:00
Vytautas Šaltenis
fecfec2059 Implement SkipImages and add test 2016-04-05 12:48:28 +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
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
Tom Kwok
69f51afe42 Add test for issue 172 2016-04-03 21:08:32 +08:00
Tom Kwok
232d06cf99 Fix regression: index out of range panic in reference link (#172, #173) 2016-04-02 22:13:43 +08: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