617 Commits

Author SHA1 Message Date
Pierre Neidhardt
6fd47b3b61 v2: Only split when inline callbacks consume some bytes (#301)
* Only split when inline callbacks consume some bytes

The former hacks around maybeLineBreak and Smartypants are no longer
needed.
The algorithm has been streamlined: shorter, simpler, faster.
The 'currBlock' field of the parser is gone.

* Remove spurious logs
2016-08-19 08:56:33 +03:00
Vytautas Šaltenis
576065633d Merge pull request #299 from Ambrevar/v2lint
html.go: Lint RenderNode()
2016-08-12 09:13:22 +03:00
Pierre Neidhardt
225250ddf1 html.go: Lint RenderNode() 2016-08-12 09:16:14 +05:30
Vytautas Šaltenis
9926922c0b Merge pull request #295 from Ambrevar/v2FactorSmarty
v2: Factor Smartypants to HTML
2016-08-10 23:01:58 +03:00
Vytautas Šaltenis
9bff4103a3 Merge pull request #293 from Ambrevar/v2ExportFuncs
v2: Export tree manipulation functions
2016-08-10 09:21:33 +03:00
Pierre Neidhardt
02da1dfe9d Factor Smartypants to HTML
Smartypants is HTML-specific.
There is no need to run Smartypants from `Render()`.
This simplifies extensions built upon the HTML renderer.
2016-08-10 09:58:33 +05:30
Pierre Neidhardt
fdbedcdb78 Export tree manipulation functions 2016-08-10 08:59:15 +05:30
Vytautas Šaltenis
37141d5b5a Merge pull request #296 from Ambrevar/v2icon
v2: Add Icon parameter to the HTML renderer
2016-08-09 22:22:31 +03:00
Vytautas Šaltenis
c9f76b530b Merge pull request #294 from Ambrevar/v2TOC2Renderer
v2: Move TOC generation to the HTML Renderer
2016-08-09 22:06:04 +03:00
Pierre Neidhardt
413328d30b Add Icon parameter to the HTML renderer 2016-08-09 17:54:34 +05:30
Pierre Neidhardt
925d99bc55 Add TOC generation tests 2016-08-09 15:11:40 +05:30
Pierre Neidhardt
b5ff8e0286 Break lines properly in TOC generation and omit content if required 2016-08-09 15:11:40 +05:30
Pierre Neidhardt
4d756003cd Move TOC generation to the HTML Renderer 2016-08-09 12:37:44 +05:30
Vytautas Šaltenis
0f3eafddfa Merge pull request #287 from Ambrevar/v2walkfix
v2: Fix walk so that it does not step outside the root node
2016-08-05 09:17:14 +03:00
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
2e23e31bd4 Fix typo 2016-08-01 20:52:17 +03:00
Vytautas Šaltenis
bb31c53390 Merge pull request #286 from russross/add-benchmark
Repeat a run of reference tests under benchmark
2016-07-31 10:22:15 +03:00
Vytautas Šaltenis
3fe4ad2966 Enable common extensions for benchmark
Also, reset the timer after loading test data.
2016-07-30 21:40:13 +03:00
Vytautas Šaltenis
c61b63f42c Repeat a run of reference tests under benchmark
Will help with optimizing later on.
2016-07-29 18:56:08 +03:00
Vytautas Šaltenis
a9baf845f1 Unpublish and rename LinkType constants (#285)
* Unpublish and rename LinkType constants

The constants are only used in the parsing phase, they are not recorded
in the AST directly, so make them private. Improve their names along the
way. Fix tagLength to return two values instead of taking an output
parameter.

* autoLinkType -> autolinkType

And remove unnecessary comment.
2016-07-29 08:01:31 +03:00
Vytautas Šaltenis
ca4bf013e8 Merge pull request #284 from russross/fix-lint
Fix most of lint errors on v2
2016-07-28 19:45:39 +03:00
Vytautas Šaltenis
a5270b6f56 Shorten method receivers in Smartypants 2016-07-28 19:26:25 +03:00
Vytautas Šaltenis
46b7355a78 Fix bullet points in MarkdownCommon docs 2016-07-28 19:23:04 +03:00
Vytautas Šaltenis
bd774a209a More lint: smartypants.go 2016-07-27 21:45:25 +03:00
Vytautas Šaltenis
6d7f5e1bca More lint: block.go 2016-07-27 21:40:45 +03:00
Vytautas Šaltenis
cd2f079140 More lint: inline.go 2016-07-27 21:31:29 +03:00
Vytautas Šaltenis
e054c962e7 More lint: markdown.go and ripples to other files 2016-07-27 21:28:41 +03:00
Vytautas Šaltenis
72633fddee Lint node.go 2016-07-27 21:04:20 +03:00
Vytautas Šaltenis
f7ec3b0e34 Fix a few lint errors, a.k.a. improve docs 2016-07-27 10:11:13 +03:00
Vytautas Šaltenis
ce05617fea Return *Latex from NewLatexRenderer 2016-07-27 09:47:58 +03:00
Vytautas Šaltenis
a4f1e5c786 Limit Node.String() to print itself, no children 2016-07-27 09:44:24 +03:00
Vytautas Šaltenis
89653c9927 Merge pull request #274 from Ambrevar/v2misc
v2: Implicit interface and Stringer
2016-07-27 09:39:58 +03:00
Dmitri Shuralyov
93622da34e Make newline mandatory for opening fence line. (#281)
This was an unintended typo/mistake in #280.

This is stricter, and it's fine. The opening fence line will always need to have a newline.

Add another test for isFenceLine.
2016-07-16 11:34:03 -04:00
Vytautas Šaltenis
fd97b7d32f Merge pull request #282 from russross/v2-fix-279
v2: Fix issue in fenced code block pre-processing.
2016-07-16 10:25:34 +03:00
Dmitri Shuralyov
2560c5f148 Fix issue in fenced code block pre-processing.
Forwardport changes from #280.

Fixes #279.
2016-07-15 17:03:02 -04:00
Vytautas Šaltenis
4e6f303e8d Merge pull request #280 from russross/fix-279-and-refactor
Fix fenced code block rendering with content resembling references.
2016-07-15 22:37:58 +03:00
Dmitri Shuralyov
a5812bb8f2 Improve fenced code block detection for first pass.
In first pass, there may not be a trailing newline after a fenced code
block yet. Make newline optional in isFenceLine when calling
fencedCodeBlock to detect the fenced code block it anyway. This is more
complex, but it avoids creating temporary buffers or modifying input in
order to maintain performance (see #148).

Document and rename fencedCode to fencedCodeBlock.

Add regression tests.

Fixes #279.
2016-07-15 15:07:43 -04:00
Dmitri Shuralyov
0049676599 Improve fence line detection.
Rename isFenceCode to isFenceLine, document it, add tests.

Add support for making newline optional, this will be needed in future
commits.
2016-07-15 14:59:57 -04:00
Dmitri Shuralyov
96537c6eaa Create a place for document-level unit tests.
These will be helpful for catching regressions or changes in behavior
to edge cases such as empty input, or specifically crafted inputs that
may cause panics, etc.

Move test for issue #172 there since it's a document-level test, not an
inline one.

Add test for issue #173.

Make some things more consistent.

Don't use a named receiver in methods that don't use it. This makes the
code more readable since one can more quickly tell the inputs to the
method.
2016-07-15 14:59:57 -04:00
Vytautas Šaltenis
6291a00f2f Remove dead fields from HTMLRenderer 2016-07-05 07:33:21 +03:00
Vytautas Šaltenis
2f1f0b6b9f Add RenderNode to Renderer interface 2016-07-05 07:32:16 +03:00
Vytautas Šaltenis
cb6bd67271 Remove dead HTMLWriter code 2016-07-04 22:02:22 +03:00
Vytautas Šaltenis
f90a576a05 Untangle some mess with attribute escaping
1. Remove unused preserveEntities parameters
2. Move attrEscape() implementation inside esc()
3. Delegate most of esc() work to escCode()
2016-07-02 10:45:06 +03:00
Vytautas Šaltenis
ab20da6e27 Merge pull request #275 from Ambrevar/v2css
v2: Fix empty path to CSS
2016-07-02 10:37:00 +03:00
Vytautas Šaltenis
7ee035eaa6 Merge pull request #276 from russross/v2-move-test-helpers-to-test-pkg
v2: Only include test helpers inside test package.
2016-07-02 10:31:14 +03:00
Dmitri Shuralyov
a41899bbac v2: Only include test helpers inside test package. 2016-07-01 11:47:39 -07:00
Pierre Neidhardt
20aa621387 Fix empty path to CSS 2016-07-01 18:18:51 +02:00
Pierre Neidhardt
2e53c20b2f Return a *HTMLRenderer from NewHTMLRenderer
Interfaces should be satisfied implicitly.
2016-07-01 17:23:30 +02: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
1d6b8e9301 Merge pull request #266 from russross/avoid-unneeded-break
Avoid unneeded break statement.
2016-05-31 14:12:24 +03:00