mbakeranalecta / sam

Semantic Authoring Markdown
Other
79 stars 8 forks source link

Smartquotes declaration #138

Closed mbakeranalecta closed 6 years ago

mbakeranalecta commented 7 years ago

Perhaps instead of making smartquotes an optional feature of the parser, we should make it a declaration in the document. That way the processing of a document should be consistent.

mbakeranalecta commented 7 years ago

Obvious question: what should be the default. Off?

mbakeranalecta commented 7 years ago

Note that if #98 is implemented this becomes moot since it will be explicit in the schema.

mbakeranalecta commented 7 years ago

One consideration is that if the regurgitate function is used on a document that has smartquotes declaration set to yes, it should change it to no. This would avoid the need to escape all the straight quotes to preserve them.

mbakeranalecta commented 6 years ago

It seems to me that this should be extensible/configurable the same way annotation lookup is post #140. It is really the same case -- shortcuts used in a particular document for markup convenience.

mbakeranalecta commented 6 years ago

98 is rejected, so this is back on the table. The question is how to customize the substitutions. It could be done as in #140" by supporting an extension of the parser, but this is not really the same case. It is just a matter of mapping a set of regex's to a set of character substitutions, which could be done with a simple configuration file.

mbakeranalecta commented 6 years ago

An argument in favor of requiring a smart quotes declaration in a document is that individual documents can differ in whether smart quotes are appropriate. While SAM does a good job of not applying smart quotes to codeblocks etc, there are still cases where they could change the meaning of a file. Therefore having them on globally for a parser run is not appropriate. We need to know if the document author intended to use smart quotes or not. Given this it seems most transparent to default smart quoted to off and to require a smart quotes declaration in the document to turn them on.

Regurgitate should always flip the smart quotes declaration to off, and should probably make it explicit even if there was no declaration to begin with.

The exact set of substitutions and patterns should not be part of the language specification. It should be up to the parser to decide what its default set of substitutions is. Users should be able to specify their own set of substitution rules.

mbakeranalecta commented 6 years ago

Implemented in Revision ad4365064bdfe61fa43228991a31b3174feb2957