marvin-zhao / pyang

Automatically exported from code.google.com/p/pyang
0 stars 0 forks source link

whitespace trimming in YIN->YANG conversion #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When doing the translation from YIN to YANG, it would be helpful to apply some 
whitespace trimming in 'description' arguments and similar strings, otherwise 
the result is ugly when theses strings are naturally indented in the YIN XML 
source. A typical result is:

  description
    "
                 Time To Live (or hop count in IPv6 terminology) that is
                 set in the IP headers of the (outer) tunnel packets. By
                 default, the tunnel packets inherit the value from the
                 inner (tunneled) packets.
                     ";

The trimming rule could be that all leading and trailing whitespace is removed 
and the second and following lines are justifed relative to the first line so 
that the above description would become

  description
    "Time To Live (or hop count in IPv6 terminology) that is
     set in the IP headers of the (outer) tunnel packets. By
     default, the tunnel packets inherit the value from the
     inner (tunneled) packets.";

Original issue reported on code.google.com by lada.lho...@gmail.com on 10 Jun 2010 at 6:34

GoogleCodeExporter commented 9 years ago
Proposal: Make a new option --yang-pretty-strings, symmetrical to 
--yin-pretty-strings.

Original comment by lada.lho...@gmail.com on 25 Jun 2010 at 1:19

GoogleCodeExporter commented 9 years ago
I think the pretty strings need to be handled at input time, i.e. in 
yin_parser.  So it would be better to add an option to read pretty yin strings. 
 Feel free to help out with this :)

Original comment by mbj4...@gmail.com on 28 Jun 2010 at 7:32

GoogleCodeExporter commented 9 years ago
The point is that a pretty-printed string is different for YANG and YIN, so 
when typing in YIN, the strings are indented to look reasonably as a multiline 
text of an XML element whereas in YANG the indentation is different.

My problem is that I prefer to input YIN using nxml-mode but when publishing 
such modules it is generally better to use the YANG syntax. Currently the only 
option is to reformat descriptions etc. manually. 

Original comment by lada.lho...@gmail.com on 1 Jul 2010 at 1:41

GoogleCodeExporter commented 9 years ago
I think this one should be closed?

Original comment by mbj4...@gmail.com on 30 Aug 2010 at 7:26

GoogleCodeExporter commented 9 years ago
A new pyang command-line option "--trim-yin" was added that does this 
whitespace trimming in the argument of 'contact', 'description', 
'error-message', 'organization', and 'reference'. Closing the issue.

Original comment by lada.lho...@gmail.com on 31 Aug 2010 at 8:54