~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to scripts/diffservice

  • Committer: mattgiuca
  • Date: 2008-06-16 06:44:28 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:774
scripts/diffservice, diff.css: HTML refactor (simpler layout - it's not valid
    to put pre inside a dt).
    Renamed CSS classes to have hyphens instead of underscores (underscores
    are illegal).

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    match_sub = re.compile(r'^\-(.*)$',re.MULTILINE)
41
41
    match_special = re.compile(r'^\\(.*)$',re.MULTILINE)
42
42
    output = match_file.sub(
43
 
        r'<span class="diff_files">\1 \2 <em>(\3)</em></span>', output)
 
43
        r'<span class="diff-files">\1 \2 <em>(\3)</em></span>', output)
44
44
    output = match_range.sub(
45
 
        r'<span class="diff_range">@@ \1 @@</span>', output)
 
45
        r'<span class="diff-range">@@ \1 @@</span>', output)
46
46
    output = match_add.sub(
47
 
        r'<span class="diff_add">+\1</span>', output)
 
47
        r'<span class="diff-add">+\1</span>', output)
48
48
    output = match_sub.sub(
49
 
        r'<span class="diff_sub">-\1</span>', output)
 
49
        r'<span class="diff-sub">-\1</span>', output)
50
50
    output = match_special.sub(
51
 
        r'<span class="diff_special">\\\1</span>', output)
 
51
        r'<span class="diff-special">\\\1</span>', output)
52
52
    return output
53
53
 
54
54
def get_revision(r_str):
118
118
    split_diff = diff_matcher.findall(diff_text)
119
119
 
120
120
    # Prints output
121
 
    req.write("<dl>\n")
122
121
    for filediff in split_diff:
123
122
        filename = filediff[0]
124
123
        diffbody = htmlfy_diff(filediff[1])
125
 
        req.write("<dt><strong>File:</strong> " + filename + "</dt>\n")
126
 
        req.write("<dd><code><pre>" + diffbody + "</pre></code></dd>\n")
127
 
    req.write("</dl>\n")
 
124
        req.write('<p><b>File:</b> %s</p>\n'
 
125
            % cgi.escape(filename))
 
126
        req.write('<pre class="diff">%s</pre>\n' % diffbody)
128
127
 
129
128
except pysvn._pysvn_2_5.ClientError, e:
130
 
    req.write("<dl><dt><strong>Error:</strong></dt><dd>\n")
131
 
    req.write(e + "\n")
132
 
    req.write("</dd></dl>\n")
 
129
    req.write('<p><b>Error:</b></p>\n')
 
130
    req.write('<pre class="diff">%s</pre>\n' % cgi.escape(e))
133
131
 
134
132
req.write('</div>\n')