Modify ↓
Opened 18 years ago
Closed 17 years ago
#5620 closed defect (wontfix)
erroneous hdfdump output of multiline (heredoc) elements
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | lowest | Milestone: | |
Component: | general | Version: | |
Severity: | trivial | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
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 (0)
Change History (1)
comment:1 by , 17 years ago
Milestone: | 0.10.5 |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.