Hatta Devel
diff hatta.py @ 724:22b21a40da4e
make the html generated by the code highlighter validate -- use spans instead of divs
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Sun Jan 10 20:36:38 2010 +0100 (2010-01-10) |
| parents | 3b5177cf4780 |
| children | ecb0716ced56 |
line diff
1.1 --- a/hatta.py Sun Jan 10 20:13:06 2010 +0100 1.2 +++ b/hatta.py Sun Jan 10 20:36:38 2010 +0100 1.3 @@ -2017,14 +2017,9 @@ 1.4 1.5 yield 0, '<div class="highlight"><pre>' 1.6 for lineno, line in source: 1.7 - if line.strip(): 1.8 - yield (lineno, 1.9 - werkzeug.html.div(line.strip('\n'), id_="line_%d" % 1.10 - formatter.line_no)) 1.11 - else: 1.12 - yield (lineno, 1.13 - werkzeug.html.div(' ', id_="line_%d" % 1.14 - formatter.line_no)) 1.15 + yield (lineno, 1.16 + werkzeug.html.span(line, id_="line_%d" % 1.17 + formatter.line_no)) 1.18 formatter.line_no += 1 1.19 yield 0, '</pre></div>' 1.20 1.21 @@ -2364,11 +2359,12 @@ 1.22 b.scrollTop=h.scrollHeight;h.parentNode.removeChild(h)}else{var l='';var m= 1.23 document.getElementsByTagName('link');for(var i=0;i<m.length;++i){var n=m[i]; 1.24 if(n.getAttribute('type')==='application/wiki'){l=n.getAttribute('href')}}if( 1.25 -l===''){return}var o=['p','h1','h2','h3','h4','h5','h6','pre','ul','div'];for( 1.26 -var j=0;j<o.length;++j){var m=document.getElementsByTagName(o[j]);for(var i=0; 1.27 -i<m.length;++i){var n=m[i];if(n.id&&n.id.match(/^line_\d+$/)){n.ondblclick= 1.28 -function(){var a=l+'#'+this.id.replace('line_','');document.location.href=a 1.29 -}}}}}}window.onload=function(){hatta_dates();hatta_edit()}""" 1.30 +l===''){return}var o=['p','h1','h2','h3','h4','h5','h6','pre','ul','div', 1.31 +'span'];for(var j=0;j<o.length;++j){var m=document.getElementsByTagName(o[j]); 1.32 +for(var i=0;i<m.length;++i){var n=m[i];if(n.id&&n.id.match(/^line_\d+$/)){ 1.33 +n.ondblclick=function(){var a=l+'#'+this.id.replace('line_',''); 1.34 +document.location.href=a}}}}}} 1.35 +window.onload=function(){hatta_dates();hatta_edit()}""" 1.36 style = """\ 1.37 html { background: #fff; color: #2e3436; 1.38 font-family: sans-serif; font-size: 96% }
