This PR fixes instances where, during conversion from WikiText or in subsequent editing, the guidelines documents fell afoul of one of the syntax traps detailed below. In cases of accidental smart quotes, I tried to remove either the quotation marks or the literal formatting, where one or the other could safely be dispensed with, before employing pass:[].
The Drupal 7 guidelines, which are littered with formatting issues, are not included here as they're expected to be dropped entirely (see #1503 / #1213).
Asciidoctor literal-text syntax traps for MarkDown authors
Asciidoctor presents some challenges around using literal syntax (text enclosed in backticks, `like this`), mostly stemming from its desire to be as flexible as possible.
Literals (backtick vs. backtick-plus fencing)
Unlike MarkDown or ReStructuredText, other formatting is not disabled inside backticks. Asciidoctor code like `the last word is *bold*` is perfectly legal. As a result, true MarkDown-style literals are achieved by enclosing text in both backticks and plus signs (+). Text +fenced like this+ has other processing like substitutions and quoting disabled, activating the other half of what we typically think of as "literal" processing. The backticks, OTOH, provide the monospace formatting, so both are needed. Full MarkDown-style literals `+look like this+`. The need for expanded fencing was mostly addressed by Igor (@ignatenkobrain) in commit 1d0bff1b208a581d76ca9e78a6e074ec15003217 7 years ago.
Special characters in literals
Because literal fencing consists of `+...+`, the literals can't contain either a backtick OR a plus sign without breaking. When a literal needs to contain a plus sign, the asciidoctor inline pass: macro is one solution. This syntax, consists of the string pass:, an optional comma-separated list of flags for processing that is still allowed, and then text enclosed in square braces ([ ]). Fencing text in plus signs (+...+) is actually just a shorthand for pass:[...], so `pass:[+]` is a literal plus sign in Asciidoctor.
Literals inside quotation marks
It's common to want to include a literal inside of quotation marks, something trivial to do in MarkDown. The text Type the command "`systemctl reboot`". in MarkDown will be formatted as: Type the command "systemctl reboot".
Unfortunately, Asciidoctor made a questionable syntax decision that complicates this severely. In Asciidoctor, sequences of quotation marks next to backticks (like "`, `", '`, and `') are the syntax for explicit curly ("smart"-style) quotation marks. So in Asciidoctor, Type the command "`systemctl reboot`". is formatted as: Type the command “systemctl reboot”.
That's almost certainly not what the author intends, and + sign fencing won't make any difference here. The only solution is to once again rely on our friend the pass: macro. The correct way to achieve the intended formatting in Asciidoctor is with this syntax: Type the command "pass:q[`systemctl reboot`]". That will format equivalent to the MarkDown syntax above. (Plus sign fencing is not needed, inside the pass:q[], because all processing is disabled except for quoting, which allows the backticks to still have their intended meaning.)
This PR fixes instances where, during conversion from WikiText or in subsequent editing, the guidelines documents fell afoul of one of the syntax traps detailed below. In cases of accidental smart quotes, I tried to remove either the quotation marks or the literal formatting, where one or the other could safely be dispensed with, before employing
pass:[].The Drupal 7 guidelines, which are littered with formatting issues, are not included here as they're expected to be dropped entirely (see #1503 / #1213).
Asciidoctor literal-text syntax traps for MarkDown authors
Asciidoctor presents some challenges around using literal syntax (text enclosed in backticks,
`), mostly stemming from its desire to be as flexible as possible.like this`Literals (backtick vs. backtick-plus fencing)
Unlike MarkDown or ReStructuredText, other formatting is not disabled inside backticks. Asciidoctor code like
`is perfectly legal. As a result, true MarkDown-style literals are achieved by enclosing text in both backticks and plus signs (the last word is *bold*`+). Text+fenced like this+has other processing like substitutions and quoting disabled, activating the other half of what we typically think of as "literal" processing. The backticks, OTOH, provide the monospace formatting, so both are needed. Full MarkDown-style literals`. The need for expanded fencing was mostly addressed by Igor (@ignatenkobrain) in commit 1d0bff1b208a581d76ca9e78a6e074ec15003217 7 years ago.+look like this+`Special characters in literals
Because literal fencing consists of
`, the literals can't contain either a backtick OR a plus sign without breaking. When a literal needs to contain a plus sign, the asciidoctor inline+...+`pass:macro is one solution. This syntax, consists of the stringpass:, an optional comma-separated list of flags for processing that is still allowed, and then text enclosed in square braces ([ ]). Fencing text in plus signs (+...+) is actually just a shorthand forpass:[...], so`pass:[+]`is a literal plus sign in Asciidoctor.Literals inside quotation marks
It's common to want to include a literal inside of quotation marks, something trivial to do in MarkDown. The text
Type the command "`systemctl reboot`".in MarkDown will be formatted as: Type the command "systemctl reboot".Unfortunately, Asciidoctor made a questionable syntax decision that complicates this severely. In Asciidoctor, sequences of quotation marks next to backticks (like
"`,`",'`, and`') are the syntax for explicit curly ("smart"-style) quotation marks. So in Asciidoctor,Type the command "`systemctl reboot`".is formatted as: Type the command “systemctl reboot”.That's almost certainly not what the author intends, and
+sign fencing won't make any difference here. The only solution is to once again rely on our friend thepass:macro. The correct way to achieve the intended formatting in Asciidoctor is with this syntax:Type the command "pass:q[`systemctl reboot`]".That will format equivalent to the MarkDown syntax above. (Plus sign fencing is not needed, inside thepass:q[], because all processing is disabled except for quoting, which allows the backticks to still have their intended meaning.)