aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-02-18 11:12:44 +0700
committerShulhan <ms@kilabit.info>2026-02-18 11:12:44 +0700
commit974b8b5068b688258dbe1ffcc37d0ce0f3f4b4c7 (patch)
tree1973262929e18e8cd0bb1d6e7ee5bae4356ae8d6
parent4956de038af8b52db6d03f0b6f5b77e6b7cfa721 (diff)
downloadasciidoctor-go-974b8b5068b688258dbe1ffcc37d0ce0f3f4b4c7.tar.xz
all: fix parsing inline format with escaped character
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.
-rw-r--r--asciidoctor.go2
-rw-r--r--inline_parser.go5
-rw-r--r--inline_parser_test.go2
-rw-r--r--testdata/inline_parser/inline_parser_test.txt5
4 files changed, 11 insertions, 3 deletions
diff --git a/asciidoctor.go b/asciidoctor.go
index 3c89afa..a762b9c 100644
--- a/asciidoctor.go
+++ b/asciidoctor.go
@@ -14,7 +14,7 @@ import (
)
// Version of this module.
-const Version = `0.7.3`
+const Version = `0.7.4`
const _lf = "\n"
diff --git a/inline_parser.go b/inline_parser.go
index 84fae21..9a33b56 100644
--- a/inline_parser.go
+++ b/inline_parser.go
@@ -1,5 +1,5 @@
-// SPDX-FileCopyrightText: 2020 M. Shulhan <ms@kilabit.info>
// SPDX-License-Identifier: GPL-3.0-or-later
+// SPDX-FileCopyrightText: 2020 M. Shulhan <ms@kilabit.info>
package asciidoctor
@@ -1074,6 +1074,9 @@ func indexByteUnescape(in []byte, c byte) (out []byte, idx int) {
}
return out, x
}
+ if isEsc {
+ isEsc = false
+ }
out = append(out, in[x])
}
return nil, -1
diff --git a/inline_parser_test.go b/inline_parser_test.go
index a468975..1e051be 100644
--- a/inline_parser_test.go
+++ b/inline_parser_test.go
@@ -1,5 +1,5 @@
-// SPDX-FileCopyrightText: 2020 M. Shulhan <ms@kilabit.info>
// SPDX-License-Identifier: GPL-3.0-or-later
+// SPDX-FileCopyrightText: 2020 M. Shulhan <ms@kilabit.info>
package asciidoctor
diff --git a/testdata/inline_parser/inline_parser_test.txt b/testdata/inline_parser/inline_parser_test.txt
index b40465d..8057970 100644
--- a/testdata/inline_parser/inline_parser_test.txt
+++ b/testdata/inline_parser/inline_parser_test.txt
@@ -1,3 +1,6 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+// SPDX-FileCopyrightText: 2022 M. Shulhan <ms@kilabit.info>
+
Various tests for inlineParser.
>>>
@@ -45,6 +48,7 @@ _A _B
`A` B
`A `B
A `/**/` *B*
+`/\*` comment `\*/`
<<< parseFormat
_A_B
@@ -57,6 +61,7 @@ _A _B
<code>A</code> B
`A `B
A <code>/<strong></strong>/</code> <strong>B</strong>
+<code>/*</code> comment <code>*/</code>
>>> parseFormatUnconstrained
__A__B