Inside of you are two wolves:

One of them wants to be grammatically correct and put the punctuation inside "the quoted text."

The other one has been programming for 25 years and is howling at the top of its lungs, "I demand proper nesting!".

@andrewrk At this point the first wolf has moved on.

But in any case, punctuation isn't part of grammar, so it's not going to affect grammatical correctness.

How did thou come to that conclusion, @typeswitch? Punctuation is as important as words (or identifiers) to deliver meaning, whether it's a formal or natural language. There are cases like the example given by @andrewrk where there is more than one way to express the same thing without ambiguity, but in general, misuse of punctuation is gonna give Godzilla a stronk.

@cnx Grammar is about spoken language, it's about how words come together to create sentences with meaning.

Punctuation is part of writing, not spoken language. It's like spelling, which is also not grammar & only applies to written language. It's a set of conventions for how to record and transmit aspects of the spoken language using symbols.

It's good to recall that the spoken language comes first & is much older than writing. Grammar has existed for much longer than punctuation or spelling.

@cnx It would be an exaggeration to say that punctuation cannot affect grammatical correctness, but in this specific case it's purely a matter of convention & doesn't affect grammatical correctness at all. As you yourself said.

@typeswitch, scripts are to record speech, and punctuation isn't just pretty decorators. It denotes pauses, changes in tones, and sometimes replacement for words or modifiers (e.g. quotation marks). Consider your own words by themselves:

grammar is about spoken language it s about how words come together to create sentences with meaning punctuation is part of writing not spoken language it s like spelling which is also not grammar & only applies to written language it s a set of conventions for how to record and transmit aspects of the spoken language using symbols it s good to recall that the spoken language comes first & is much older than writing grammar has existed for much longer than punctuation or spelling

@cnx @typeswitch the quotation marks placing here has more to do with typography than grammar tho
@xarvos @cnx @typeswitch I've just had a thought: the placement of the punctuation inside the quotes is basically an extreme form of kerning.
@cnx Ah I think you misinterpreted what I meant in the first post. My saying that it's not going to affect grammatical correctness should be understood in the context of the original example, not as a generality.
@cnx @typeswitch @andrewrk punctuation is covered by "orthography".