diff --git a/templates/coal/map b/templates/coal/map --- a/templates/coal/map +++ b/templates/coal/map @@ -52,7 +52,8 @@ filerevision = ../paper/filerevision.tmp 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 --git a/templates/paper/map b/templates/paper/map --- a/templates/paper/map +++ b/templates/paper/map @@ -52,7 +52,8 @@ filerevision = filerevision.tmpl fileannotate = fileannotate.tmpl filediff = filediff.tmpl filelog = filelog.tmpl -fileline = '
{linenumber} {line|escape}
' +fileline = ' +
{linenumber} {line|escape}
' filelogentry = filelogentry.tmpl annotateline = ' diff --git a/tests/test-hgweb-commands.out b/tests/test-hgweb-commands.out --- a/tests/test-hgweb-commands.out +++ b/tests/test-hgweb-commands.out @@ -435,6 +435,7 @@ files, or words in the commit message
line source
+
1 foo
diff --git a/tests/test-highlight.out b/tests/test-highlight.out --- a/tests/test-highlight.out +++ b/tests/test-highlight.out @@ -76,7 +76,39 @@ files, or words in the commit message
line source
-
1 #!/usr/bin/env python
2
3 """Fun with generators. Corresponding Haskell implementation:
4
5 primes = 2 : sieve [3, 5..]
6 where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
7 """
8
9 from itertools import dropwhile, ifilter, islice, count, chain
10
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
21
22 odds = ifilter(lambda i: i % 2 == 1, count())
23 return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
24
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
+
2
+
3 """Fun with generators. Corresponding Haskell implementation:
+
4
+
5 primes = 2 : sieve [3, 5..]
+
6 where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
+
7 """
+
8
+
9 from itertools import dropwhile, ifilter, islice, count, chain
+
10
+
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
+
21
+
22 odds = ifilter(lambda i: i % 2 == 1, count())
+
23 return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
+
24
+
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 @@ files, or words in the commit message
line source
+
1 h?bsch