##// END OF EJS Templates
hgweb: move the `seq` function out of the revnavgen scope...
Pierre-Yves David -
r18389:82572533 default
parent child Browse files
Show More
@@ -24,6 +24,17 b' def up(p):'
24 return "/"
24 return "/"
25 return up + "/"
25 return up + "/"
26
26
27 def _navseq(factor, limit=None):
28 if limit:
29 yield limit
30 if limit >= 20 and limit <= 40:
31 yield 50
32 else:
33 yield 1 * factor
34 yield 3 * factor
35 for f in _navseq(factor * 10):
36 yield f
37
27 def revnavgen(pos, pagelen, limit, nodefunc):
38 def revnavgen(pos, pagelen, limit, nodefunc):
28 """computes label and revision id for navigation link
39 """computes label and revision id for navigation link
29
40
@@ -38,22 +49,12 b' def revnavgen(pos, pagelen, limit, nodef'
38 - values are generator functions taking an arbitrary number of kwargs
49 - values are generator functions taking an arbitrary number of kwargs
39 - yield items are dictionaries with `label` and `node` keys
50 - yield items are dictionaries with `label` and `node` keys
40 """
51 """
41 def seq(factor, limit=None):
42 if limit:
43 yield limit
44 if limit >= 20 and limit <= 40:
45 yield 50
46 else:
47 yield 1 * factor
48 yield 3 * factor
49 for f in seq(factor * 10):
50 yield f
51
52
52 navbefore = []
53 navbefore = []
53 navafter = []
54 navafter = []
54
55
55 last = 0
56 last = 0
56 for f in seq(1, pagelen):
57 for f in _navseq(1, pagelen):
57 if f < pagelen or f <= last:
58 if f < pagelen or f <= last:
58 continue
59 continue
59 if f > limit:
60 if f > limit:
General Comments 0
You need to be logged in to leave comments. Login now