Re: Is there a good reason to use an entity code for double quotes inside the code element

On Sun, Nov 19, 2017 at 12:19 AM, Martin J. Dürst
<duerst@it.aoyama.ac.jp> wrote:
> On 2017/11/19 16:28, Liam R. E. Quin wrote:
>> On Sat, 2017-11-18 at 22:26 -0800, Matt King wrote:
>>> Is there a good reason to use &quot; instead of " when writing code
>>> samples in our specs?
>>
>> None that i'm aware of. You need &amp; and &lt; though.
>
> If there's one, then it's probably "No need to have to think about whether
> I'm in an attribute, or in content." That can come in handy in programs, or
> when you expect a lot of copying of content from attribute values to content
> and back.

Right. All you need, to be precise, is:

1. In text, escape & and <.
2. In a quoted attribute value, escape & and whatever character you
use for quoting (either ' or "). (Unquoted attribute values have more
complex rules, only use them if you have simple values.)

But it's safe to escape all four at all times if you don't want to
have to think about it.

(People often escape > as well for some reason. It's always safe to
use unquoted, tho.)

~TJ

Received on Saturday, 2 December 2017 01:24:19 UTC