Some Ducktype Development
Shaun McCance
<shaunm at gnome.org>
Sun May 22 20:08:00 EDT 2016
- Previous message: Some Ducktype Development
- Next message: Ducktype Comment Proposal
- Sort by: [ thread ] [ subject ] [ author ] [ date ]
On Sun, 2016-05-22 at 23:41 +0000, philip.chimento at gmail.com wrote: > On Sun, May 22, 2016 at 2:27 AM Shaun McCance <shaunm at gnome.org> > wrote: > > I'm also working on comments, using [[-- --]] or possibly [[# #]] > > (opinions or other suggestions welcome). These would be parsed at > > the > > line level only, not e.g. inline. So a starting [[-- has to be at > > the > > beginning of a line, possibly preceded with whitespace. > > > > Thoughts? > If comments are only processed at a line level, then having a syntax > for them that you open and close seems misleading; it would imply to > me that you could put more content after the closing --]], like you > can in XML. Yeah, that occurred to me as well. It's worth noting that Ducktype is designed so that you can parse blocks first, then parse the inline content of each block in a separate pass. So that limits things. It could be a line starter, but I want to use something with "[[" to avoid new special characters. And this looks dumb because you expect closing brackets: [[# This is commented out. [[# This is also commented out. (Though I suppose it could be an open-close syntax, like: [#] This is a comment. Actually, now that I write that out, I kind of like it.) I like forcing the comment start and end markers to be at the start of the line (possibly with whitespace), because that easily obviates the need to parse escape sequences. And that means you could easily strip comments with a few lines of awk, if you want, I guess. But it opens the question of what this means: [[-- Clearly commented out. Also clearly commented out. --]] What's this? Two options I can think of: 1) We just start parsing again after --]]. So "What's this" is real content, and you need to be careful about indenting *after* the --]] if you're in any indented block. 2) We throw the entire line away. This is probably not what anybody would expect, but it's not without precedent. Because right now, any text content after a block declaration on the same line is thrown away. For example: [note stype=tip] Did you know this text is thrown away? It's true. But this text is a paragraph. Of course, maybe that's stupid, and it should change too. One other thing I should mention is that I also want to add a fenced no-parse syntax, something along these lines: [code] [[[ You don't have to worry about escaping anything here. ]]] And at the moment, I'm trying to model the comment syntax to somewhat mirror how that would parse. Although in that case, we almost certainly would *not* throw away post-close text: [code] [[[ You don't have to worry about escaping anything here. ]]] No way we're throwing this away. So, stuff to chew on. Corner cases are hard. Thanks for the feedback. -- Shaun
- Previous message: Some Ducktype Development
- Next message: Ducktype Comment Proposal
- Sort by: [ thread ] [ subject ] [ author ] [ date ]
- More information on mallard-list