Ticket #5620 (closed defect: wontfix)
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
259 259 add_value(name, value) 260 260 261 261 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 """ 262 276 from StringIO import StringIO 263 277 buf = StringIO() 264 278 def hdf_tree_walk(node, prefix=''): … … 270 284 if value.find('\n') == -1: 271 285 buf.write(' = %s' % value) 272 286 else: 273 buf.write(' =<< EOM\n%s\nEOM' % value)287 buf.write(' << EOM\n%s\nEOM' % value) 274 288 if node.child(): 275 289 buf.write(' {\n') 276 290 hdf_tree_walk(node.child(), prefix + ' ')
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


