newsdev/archieml.org

Make inline comments configurable

Closed this issue · 4 comments

Copying over from @aplayford in newsdev/archieml-js#8:

Right now, anything enclosed in [brackets] is interpreted as a comment. But many newspapers use brackets in news copy to indicate words that were added by the writer to a quote for clarity.

Could the trigger be configurable? A multi-character combination would be especially helpful (so we can find something unlikely to clash and that doesn't interfere with our templating system).

Adam
Tampa Bay Times

This also seems relevant to newsdev/archieml-js#5, as well as an issue I came across recently in writing cross-parser tests: how to include JSON as part of an AML document. Because all text inside single brackets is stripped out, that makes it difficult to store JSON that contains an array as a value:

json: {array: [1, 2, 3]}

Will get converted to {"json": "{array: }"}, which is pretty useless.

The most simple solution would be to have a setting that toggles this on and off. A more complex solution for parsers would be making it adjustable.

Toggling off would solve our problem! For this type of content we really don't need inline comments (and if we really did we do it with our templating language)...

Adam
Tampa Bay Times

I took a stab at implementing this in archieml-js at newsdev/archieml-js#11. Want to try it out @aplayford and see whether that would work for you?

I'm inclined to go the toggle route over configuring the comment syntax, since inline comments do not alter the resulting document structure, making it trivial to pass values through a custom regex as needed post-parsing.

This should work perfectly but we'll test it and let you know. Thank you!