aboutsummaryrefslogtreecommitdiff
path: root/inline_parser.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-03-02 23:00:07 +0700
committerShulhan <ms@kilabit.info>2023-03-02 23:00:19 +0700
commit35c7edc6cb26bf63fc8cf1f61d5e33fc9ee620ef (patch)
tree17600d2f860187130f23a52c9e603519eaaaa444 /inline_parser.go
parent5b83f6228897c3a7f24fa7b60cb30310bb5f2dcf (diff)
downloadasciidoctor-go-35c7edc6cb26bf63fc8cf1f61d5e33fc9ee620ef.tar.xz
all: ignore parsing block image in paragraph
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.
Diffstat (limited to 'inline_parser.go')
-rw-r--r--inline_parser.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/inline_parser.go b/inline_parser.go
index 621c21e..0e280d7 100644
--- a/inline_parser.go
+++ b/inline_parser.go
@@ -689,6 +689,13 @@ func parseInlineImage(doc *Document, content []byte) (elImage *element, n int) {
lineImage []byte
)
+ // If the next character is ':' (as in block "image::") mark it as
+ // invalid inline image, since this is block image that has been
+ // parsed but invalid (probably missing '[]').
+ if content[0] == ':' {
+ return nil, 0
+ }
+
_, n = indexByteUnescape(content, ']')
if n < 0 {
return nil, 0