Edgewall Software

Ticket #5620 (closed defect: wontfix)

Opened 19 months ago

Last modified 16 months ago

erroneous hdfdump output of multiline (heredoc) elements

Reported by: Narcelio Filho <narcelio+filho@…> Owned by: jonas
Priority: lowest Milestone:
Component: general Version:
Severity: trivial Keywords:
Cc:

Description

Multi-line HDF elements are being generated wrong for hdfdump. HDFWrapper generates this:

foo {
 bar = << EOM
line1
line2
EOM
}

when should generate this:

foo {
 bar << EOM
line1
line2
EOM
}

(without the equal sign)

Clearsilver tool chokes when feed with first example:

$ cs -h test.hdf
Traceback (innermost last):
  File "neo_hdf.c", line 1840, in hdf_read_file()
  File "neo_hdf.c", line 1678, in _hdf_read_string()
    In file test.hdf:3
  File "neo_hdf.c", line 1739, in _hdf_read_string()
ParseError: [test.hdf:3] Unable to parse line line1

Reference: ClearSilver HDF Dataset

Working patch (with doctest testcase):

  • trac/web/clearsilver.py

     
    259259        add_value(name, value) 
    260260 
    261261    def __str__(self): 
     262        """ 
     263        Returns the HDF dataset 
     264 
     265        >>> hdf = HDFWrapper() 
     266        >>> hdf['test.multiline'] = '''line1 
     267        ... line2''' 
     268        >>> print hdf 
     269        test { 
     270          multiline << EOM 
     271        line1 
     272        line2 
     273        EOM 
     274        } 
     275        """ 
    262276        from StringIO import StringIO 
    263277        buf = StringIO() 
    264278        def hdf_tree_walk(node, prefix=''): 
     
    270284                    if value.find('\n') == -1: 
    271285                        buf.write(' = %s' % value) 
    272286                    else: 
    273                         buf.write(' = << EOM\n%s\nEOM' % value) 
     287                        buf.write(' << EOM\n%s\nEOM' % value) 
    274288                if node.child(): 
    275289                    buf.write(' {\n') 
    276290                    hdf_tree_walk(node.child(), prefix + '  ') 

Attachments

Change History

Changed 16 months ago by cboos

  • status changed from new to closed
  • resolution set to wontfix
  • milestone 0.10.5 deleted

We're dropping support for ClearSilver, so there's no real need for that anymore. However, if someone else feels like committing the patch, please do.

Add/Change #5620 (erroneous hdfdump output of multiline (heredoc) elements)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.