Changeset a6ba8be6bca2170f660041eb9b4a8b5f3c13ca2b


Ignore:
Timestamp:
22.05.2013 22:36:37 (6 years ago)
Author:
Stanislaw Klekot <dozzie@…>
Branches:
b66903eafbcb1d49112014abc82c8bf683413db0
Children:
e9eab1ae79ce55966309ad074f7ef6d722641fb9, b66903eafbcb1d49112014abc82c8bf683413db0
Parents:
87dc059a4d9a3e784a8831cbcb3f7b2ad7b54b99
git-author:
Stanislaw Klekot <dozzie@…> (22.05.2013 22:34:01)
git-committer:
Stanislaw Klekot <dozzie@…> (22.05.2013 22:36:37)
Message:

Added intermediate text_paragraph_line node.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dashwiki/markup/_tree_utils.py

    rce2318 ra6ba8b  
    9191  # way it would be easier to debug stuff 
    9292 
     93  # add nodes representing <br>-delimited parts of paragraph 
     94  # NOTE: this should occur *before* descending to nodes recursively 
     95  # (otherwise new nodes "text_paragraph_line" won't get simplified) 
     96  if name == 'text_paragraph': 
     97    lines = [{ 'text_paragraph_line': [] }] 
     98    for l in value: 
     99      if 'LINE_BREAK' in l: 
     100        lines.append({ 'text_paragraph_line': [] }) 
     101      else: 
     102        lines[-1]['text_paragraph_line'].append(l) 
     103    value = tree[name] = lines 
     104 
     105  #----------------------------------------------------------------- 
    93106  # default action: descend recursively 
     107 
    94108  if type(value) == dict: 
    95109    value = tree[name] = tree_cleanup(value) 
     
    97111    value = tree[name] = [tree_cleanup(v) for v in value] 
    98112 
    99   if name == 'text_paragraph': 
     113  #----------------------------------------------------------------- 
     114  # some postprocessing 
     115 
     116  # kill trailing spaces in regular text 
     117  if name == 'text_paragraph_line': 
    100118    if type(value) == list and value[-1] == ' ': 
    101119      del value[-1] 
     
    148166 
    149167#----------------------------------------------------------------------------- 
    150 # vim:ft=python 
     168# vim:ft=python:foldmethod=marker 
Note: See TracChangeset for help on using the changeset viewer.