# HG changeset patch # User Martin Geisler # Date 1242593510 -7200 # Node ID 835b1ee111f45aa034d4eca3eb62938ac598d5ef # Parent 0b93eff3721dacb038b3c9287db3b34aa0f0cd56 coal, paper: add newlines when displaying a file in hgweb The newlines make the HTML somewhat readable and gives much smaller, readable diffs when the tests change. diff -r 0b93eff3721d -r 835b1ee111f4 templates/coal/map --- a/templates/coal/map Sun May 17 21:47:24 2009 +0200 +++ b/templates/coal/map Sun May 17 22:51:50 2009 +0200 @@ -52,7 +52,8 @@ fileannotate = ../paper/fileannotate.tmpl filediff = ../paper/filediff.tmpl filelog = ../paper/filelog.tmpl -fileline = '
{linenumber} {line|escape}
' +fileline = ' +
{linenumber} {line|escape}
' filelogentry = ../paper/filelogentry.tmpl annotateline = ' diff -r 0b93eff3721d -r 835b1ee111f4 templates/paper/map --- a/templates/paper/map Sun May 17 21:47:24 2009 +0200 +++ b/templates/paper/map Sun May 17 22:51:50 2009 +0200 @@ -52,7 +52,8 @@ fileannotate = fileannotate.tmpl filediff = filediff.tmpl filelog = filelog.tmpl -fileline = '
{linenumber} {line|escape}
' +fileline = ' +
{linenumber} {line|escape}
' filelogentry = filelogentry.tmpl annotateline = ' diff -r 0b93eff3721d -r 835b1ee111f4 tests/test-hgweb-commands.out --- a/tests/test-hgweb-commands.out Sun May 17 21:47:24 2009 +0200 +++ b/tests/test-hgweb-commands.out Sun May 17 22:51:50 2009 +0200 @@ -435,6 +435,7 @@
line source
+
1 foo
diff -r 0b93eff3721d -r 835b1ee111f4 tests/test-highlight.out --- a/tests/test-highlight.out Sun May 17 21:47:24 2009 +0200 +++ b/tests/test-highlight.out Sun May 17 22:51:50 2009 +0200 @@ -76,7 +76,39 @@
line source
-
1 #!/usr/bin/env python
3 """Fun with generators. Corresponding Haskell implementation:
5 primes = 2 : sieve [3, 5..]
6 where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
7 """
9 from itertools import dropwhile, ifilter, islice, count, chain
11 def primes():
12 """Generate all primes."""
13 def sieve(ns):
14 p = ns.next()
15 # It is important to yield *here* in order to stop the
16 # infinite recursion.
17 yield p
18 ns = ifilter(lambda n: n % p != 0, ns)
19 for n in sieve(ns):
20 yield n
22 odds = ifilter(lambda i: i % 2 == 1, count())
23 return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
25 if __name__ == "__main__":
26 import sys
27 try:
28 n = int(sys.argv[1])
29 except (ValueError, IndexError):
30 n = 10
31 p = primes()
32 print "The first %d primes: %s" % (n, list(islice(p, n)))
+ +
1 #!/usr/bin/env python
+ +
3 """Fun with generators. Corresponding Haskell implementation:
+ +
5 primes = 2 : sieve [3, 5..]
+
6 where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
+
7 """
+ +
9 from itertools import dropwhile, ifilter, islice, count, chain
+ +
11 def primes():
+
12 """Generate all primes."""
+
13 def sieve(ns):
+
14 p = ns.next()
+
15 # It is important to yield *here* in order to stop the
+
16 # infinite recursion.
+
17 yield p
+
18 ns = ifilter(lambda n: n % p != 0, ns)
+
19 for n in sieve(ns):
+
20 yield n
+ +
22 odds = ifilter(lambda i: i % 2 == 1, count())
+
23 return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
+ +
25 if __name__ == "__main__":
+
26 import sys
+
27 try:
+
28 n = int(sys.argv[1])
+
29 except (ValueError, IndexError):
+
30 n = 10
+
31 p = primes()
+
32 print "The first %d primes: %s" % (n, list(islice(p, n)))
@@ -162,6 +194,7 @@
line source
+
1 h?bsch