aboutsummaryrefslogtreecommitdiff
path: root/inline_parser.go
AgeCommit message (Collapse)Author
2026-02-18all: fix parsing inline format with escaped characterShulhan
If the text inside the inline format contains escaped character, the parsing failed to find the closed character which cause the format is not rendered as expected.
2025-02-18all: remove the "nolint" tagShulhan
The nolint tag is to ignore being linted by golangci-lint. Since we are not using golangci-lint anymore, we can remove it.
2024-10-15all: group all image related method and functions into single fileShulhan
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.
2024-03-05all: comply with linter recommendationsShulhan
2024-03-05all: replace module "share" with "pakakeh.go"Shulhan
2023-12-09all: replace linter golangci-lint with revive and shadowShulhan
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.
2023-03-02all: ignore parsing block image in paragraphShulhan
Previously, if we have block image in paragraph, we parse it as inline image but with invalid src, for example image::my.png[multi line] would be parsed as <img src=":imy.png" alt="multi line">. This is incorrect according to asciidoctor output.
2022-11-27all: implement inline macro for passthrough ("pass:")Shulhan
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/
2022-11-23all: make the macro parser independent, out of inlineParserShulhan
The idea is to move the parser to macro later so it can be reused by html substitution.
2022-10-20all: implement macro "footnote:"Shulhan
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.
2022-08-06all: rewrite unit tests for inlineParser using test.DataShulhan
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.
2022-08-05all: cleaning up codesShulhan
Use raw string literal whenever possible.
2022-07-16all: reformat all Go filesShulhan
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.
2022-07-16all: realign all structsShulhan
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.
2022-07-16all: reformat all Go filesShulhan
2022-02-21all: relicense the asciidoctor-go under GPL 3.0 or laterShulhan
Signed-off-by: Shulhan <ms@kilabit.info>
2021-12-06all: fix parsing and rendering cross referenceShulhan
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.
2020-12-26all: replace space surrounding the em-dash with html symbol thin spaceShulhan
If the em-dash strings "--" flanked by space, replace the space with HTML symbol thin space.
2020-12-25inline_parser: add zero-width space after ellipsis characterShulhan
This is to make it compatible with generated HTML from asciidoctor.
2020-12-24parser: wrap value of email ref name with "mailto:[<value>]"Shulhan
This is to allow the inline parser to pick it up as macro link.
2020-12-24all: rename adocNode to elementShulhan
Using prefix adoc to module asciidoc is kinda bit stutter.
2020-12-20all: use consistent names for parserShulhan
Instead of parserX (or parser_x.go) we move the X as prefix so it will become XParser (or x_parser.go).