| Age | Commit message (Collapse) | Author |
|
Some of attribute may depends on property of the Document.
|
|
This is to make it easy to see how it parsed and how it written to HTML,
make the code more searchable.
While at it, add test for block image.
|
|
The WriteByte is the method in that conform [io.ByteWriter].
|
|
Each lines to be parsed has been trimmed on the first load, so
there is no need to do it again, on some cases.
|
|
The ":leveloffset:" on document attribute allow increment
or decrement the heading level on included files.
Reference: https://docs.asciidoctor.org/asciidoc/latest/directives/include-with-leveloffset/
|
|
Using struct limit the value to only string, while some attributes
can be an integer value, for example "leveloffset".
|
|
The idea is to provide consistent naming for metadata and attribute.
The AsciiDoctor documentation mostly name them as document attribute.
|
|
|
|
|
|
|
|
The golangci-lint does not output any results anymore
Either we are getting good at writing Go or the linter itself is become
less good.
We also have seen that the latest golangci-lint is failed to build
with Go tip, a simple "make" on the golangci-lint never success in my
experiences.
This changes fix all the output reported by the revive and shadow.
|
|
The unordered list item with hyphen ('-') cause too much confusion and
inconsistency, nevertheless most of still use it.
Case one, given the following markup,
```
- Item 1
+
"A line
of quote"
-- Author
```
Is the "Author" the sub item in list or we are parsing author of quote
paragraph?
Case two, the writer want to write em dash (`—` in HTML Unicode) but
somehow the editor wrap it and start in new line.
As a reminder, the official documentation only recommend using hyphen for
simple list item [1].
[1] https://docs.asciidoctor.org/asciidoc/latest/lists/unordered/#basic-unordered-list
|
|
This is to prevent empty preamble being rendered in HTML content.
|
|
In the parseListOrdered, each time we found list item, we store its
counter and increment it by one so backend can use it to render the
counter.
|
|
The inline passthrough "pass:" can be used to control the substitutions
applied to a run of text.
Ref: https://docs.asciidoctor.org/asciidoc/latest/pass/pass-macro/
|
|
Macro footnote grammar,
----
"footnote:" [ REF_ID ] "[" STRING "]"
----
In asciidoctor, footnote can be placed anywhere, even after WORD without
space in between.
The REF_ID, define the unique ID for footnote and can be used to reference
the previous footnote.
The first footnote with REF_ID, should have the STRING defined.
The next footnote with the same REF_ID, should not have the STRING
defined; if its defined, the STRING is ignored.
|
|
Using string literal for testing string input that may contains backtick
or double quote make the test code become unreadable and hard to modify.
The test.Data help this by moving the input and expected output into
a file that can we write as is.
|
|
Use raw string literal whenever possible.
|
|
Replace any usage of ":=" with "var" declaration with type.
The ideas is to make the code reader know what is the expected return
value of function/method.
|
|
Minimize struct allocation,
* columnFormat: from 40 to 16 bytes (-24 bytes)
* document: from 400 to 392 bytes (-8 bytes)
* element: from 312 to 264 bytes (-48 bytes)
* elementAttribute: from 80 to 72 bytes (-8 bytes)
* elementInclude: from 128 to 120 bytes (-8 bytes)
* elementTable: from 88 to 64 bytes (-24 bytes)
* inlineParser: from 64 to 40 bytes (-24 bytes)
Plus all structs in the test files.
|
|
|
|
Signed-off-by: Shulhan <ms@kilabit.info>
|
|
Given the following asciidoc check box markup,
* [ ] abc
It will rendereded as "❏ bc" instead of "❏ abc".
This commit fix this issue.
|
|
Both of those functions has been deprecated.
Since the Title function is to convert the adminition string into a
human title (first letter uppercase), we can use a function to do that.
Any unknown admonition will be returned as is.
|
|
Previously, when parsing cross reference we assume that if the string
contains upper-case letter then it's a label so we store it as title
to search for ID later.
The bug is when ID is set manually and its contains upper-case for
example "[#Id]".
This changes fix this issue by storing cross reference first, not
assuming it as ID or title, and then when doing rendering we check
whether its ID or title.
|
|
This is to minimize call stack size since the method will be called
recursively.
|
|
|
|
|
|
|