Skip to content

Commit

Permalink
Parsing and CSS Refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayson Vantuyl committed Mar 15, 2009
1 parent 723e306 commit 63a79e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
5 changes: 5 additions & 0 deletions src/html/static/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ html body {
margin-right: 1em;
min-height: 1em;
}

.break {
min-height: 1em;
}

20 changes: 6 additions & 14 deletions src/html/util/xml_to_interactive_html
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,26 @@ def iostream(j):
x = l[0]; del l[0]
if x is BREAK: # Spacer for Line Break
if l and l[0] is BREAK:
result.extend('<div class="break" style="min-height:1em;"></div>')
result.extend('<div class="break"></div>')
elif isinstance(x, symbol):
pass # Skip Unknown Sentinel Values
else:
result.append(x)
return result

def linify(text,delim='\n'):
def linify(text,delim='\n',tail=False):
if text is None or text == '':
return
first = True
splt = text.split(delim)
mult = len(splt) > 1
if not splt[0].strip():
del splt[0]
if splt and not splt[-1].strip():
del splt[-1]
yield BREAK
for line in splt:
if mult:
yield '<div class="cdata">'
yield escape(line)
if first:
first = False
else:
yield BREAK
if mult:
yield '</div>'
ln = escape(line)
if ln.strip():
yield ln

def getrootlist(tr):
root = tr.getroot()
Expand Down Expand Up @@ -131,7 +123,7 @@ def listify(el):
elif isinstance(el.tag,StringTypes):
kids = []
att = el.attrib
ctext = 'class="element%s"'
ctext = 'class="element"'
text = list(linify(el.text))
for kid in el:
kids.extend(listify(kid))
Expand Down

0 comments on commit 63a79e0

Please sign in to comment.