On 29/06/2018 00:03, Kent Watsen wrote:
Hi Robert,
2) The proposed solution always left indents the wrapped line. Often for
artwork (e.g. a YANG tree diagram), where whitespace is not significant,
and the wrapping is relatively minor, then right indenting the wrapped
line can make the results look more visually readable.
The placement of the indents in the example above would be impossible
to automate - they're too artsy ;)
They are just right indented, so it is pretty easy to figure out? E.g.
start at (Max line length - number of wrapped chars)
My bad, I didn't catch that they were right-indented before. Hmmmm,
interesting idea, worth keeping in mind. I see how it produces good
results sometimes, but it also seems like it could produce some results
that are not as good as indenting to the first whitespace character
from the previous line.
Sure, that decision on how to intend the wrapped line could be down to
the tool that is performing the folding, perhaps predicated by user
input or the type of diagram that is being folded.
E.g. I agreed with Martin's comments that it is better to specify the
required behavior rather than describe a specific algorithm on how it is
constructed.
Note the error in the unfolded version. I think disallowing
whitespace characters on the fold column in the source artwork is
overly limiting, spaces being so commonly used. The only way I
can think to preserve the space character is to have a fixed
indent rule (e.g., some hardcoded column number, or always use
the same indent as previous line, or the same as the previous
line plus some fixed offset). Given a clear rule, the unfolding
alg can chomp just the right amount of whitespace out, leaving
the any remaining whitespace, so the round-trip result is loss-less.
There other ways to solve this, at a slight increase in complexity.
E.g. You could use two marker characters, e.g. as below, where
everything between and including the two '\' characters is stripped.
Simple folding tools could just put the second '\' at the beginning of
the next line, or at a fixed column, more sophisticated tools could put
more effort into making it more readable, but still preserve the ability
to get the exact source back out again.
| | +--rw default? empty
| +--:(untagged)
| | +--rw untagged? empty
| +--:(dot1q-priority-tagged)
| | +--rw dot1q-priority-tagged
| | +--rw tag-type? dot1q-types:dot1q-\
\tag-type
| +--:(dot1q-vlan-tagged)
| +--rw dot1q-vlan-tagged
Clever! Having both seems to resolve many issues, and it might be within
reach of a `sed` one-liner again. The only issue might be readability,
since it's so different than the time-aged convention...
Only one thin character different ;-)
Perhaps it could be the start of a new convention that is a bit more
flexible, explicit, and robust ...
Rob
Rob
Kent // contributor
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod