You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove the constraint on substitutions not being applied if the first character is an escaped single quote on attribute list enclosed in single quotes
#4347
Open
ggrossetie opened this issue
Aug 29, 2022
· 2 comments
According to the documentation substitutions are not performed if the first character is an escaped single quote:
If there is a closing single quote, and the first character is not an escaped single quote, substitutions are performed on the value as described in Substitutions.
In my opinion, we should either clarify why we need this constraint or remove it. In fact, this constraint produces odd behaviour on edge cases and I can't understand why we need it.
Single curved quotation
Let's say, I want to use single curved quotation on a positional (or named) attribute:
['\'`foobar`\'']
para
In the above example, I'm using a single quote to enable substitutions and then an escaped single quote to enclose the word foobar in single curved quotation.
I would expect the above to produce:
expected={1=>"‘foobar’"}
but, currently, it produces:
current={1=>"'`foobar`'"}
which is odd because I get the same result using:
["'`foobar`'"]
Single quote at the beginning of a sentence
Another example with the sentence 'tis but a _scratch_:
['\'tisbuta_scratch_']
I would expect the above to produce:
expected={1=>"'tis but a <em>scratch</em>"}
but, currently, it produces:
current={1=>"'tis but a _scratch_"}
If I change the sentence to it's just a _scratch_ then it's working as expected:
current={1=>"it’s just a <em>scratch</em>"}
The text was updated successfully, but these errors were encountered:
I think you are misinterpreting the documentation. The documentation is only pointing out that the enclosure of a single-quoted value cannot itself be escaped. In other words, this is not a single-quoted value:
name=\'value
That's because the single quote is escaped. That's all the documentation is saying.
I think you'll find that you can use escaped single quotes in a single-quoted value for formatting. For example:
[title='\'`*strong*`\'']
paragraph
I think the issue you're observing is that substitutions aren't always applied to single-quoted values. One such case is in the first positional attribute. But that has more to do with the fact that the language never defined a single-quoted value as being a substituted value globally, but rather only in certain circumstances. And if that is going to change, it must be done in the language. I don't think, however, that substitutions (or inline parsing) should ever be done to the first positional attribute of a block since that is reserved for the block name/style and needs to be plain text.
If you think a documentation update is needed to clarify this point, we could certainly make that update...though you are pointing to the docs in the AsciiDoc Language project, so the change would need to be sent there.
According to the documentation substitutions are not performed if the first character is an escaped single quote:
https://docs.asciidoctor.org/asciidoc/latest/attributes/positional-and-named-attributes/#attribute-list-parsing
In my opinion, we should either clarify why we need this constraint or remove it. In fact, this constraint produces odd behaviour on edge cases and I can't understand why we need it.
Single curved quotation
Let's say, I want to use single curved quotation on a positional (or named) attribute:
In the above example, I'm using a single quote to enable substitutions and then an escaped single quote to enclose the word
foobar
in single curved quotation.I would expect the above to produce:
but, currently, it produces:
which is odd because I get the same result using:
["'`foobar`'"]
Single quote at the beginning of a sentence
Another example with the sentence
'tis but a _scratch_
:I would expect the above to produce:
but, currently, it produces:
If I change the sentence to
it's just a _scratch_
then it's working as expected:The text was updated successfully, but these errors were encountered: