Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Comments

@ggrossetie
Copy link
Member

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.

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:

['\'`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_:

['\'tis but a _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&#8217;s just a <em>scratch</em>" }
@mojavelinux
Copy link
Member

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.

@mojavelinux
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@mojavelinux @ggrossetie and others