Skip to content

Commit 97bbb42

Browse files
committed
---
yaml --- r: 174421 b: refs/heads/auto c: 39e19cc h: refs/heads/master i: 174419: 3ccc987 v: v3
1 parent 048b1ee commit 97bbb42

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: de6f520192d76151bf99f2250afac75da3f040d5
13+
refs/heads/auto: 39e19ccdb6c89703a9c88eb88a26f61ec10d31f3
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/etc/htmldocck.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,43 @@ def close(self):
148148

149149
Command = namedtuple('Command', 'negated cmd args lineno')
150150

151-
LINE_PATTERN = re.compile(r'(?<=(?<!\S)@)(?P<negated>!?)(?P<cmd>[A-Za-z]+(?:-[A-Za-z]+)*)(?P<args>.*)$')
151+
# returns a generator out of the file object, which
152+
# - removes `\\` then `\n` then a shared prefix with the previous line then optional whitespace;
153+
# - keeps a line number (starting from 0) of the first line being concatenated.
154+
def concat_multi_lines(f):
155+
lastline = None # set to the last line when the last line has a backslash
156+
firstlineno = None
157+
catenated = ''
158+
for lineno, line in enumerate(f):
159+
line = line.rstrip('\r\n')
160+
161+
# strip the common prefix from the current line if needed
162+
if lastline is not None:
163+
maxprefix = 0
164+
for i in xrange(min(len(line), len(lastline))):
165+
if line[i] != lastline[i]: break
166+
maxprefix += 1
167+
line = line[maxprefix:].lstrip()
168+
169+
firstlineno = firstlineno or lineno
170+
if line.endswith('\\'):
171+
lastline = line[:-1]
172+
catenated += line[:-1]
173+
else:
174+
yield firstlineno, catenated + line
175+
lastline = None
176+
firstlineno = None
177+
catenated = ''
178+
179+
LINE_PATTERN = re.compile(r'''
180+
(?<=(?<!\S)@)(?P<negated>!?)
181+
(?P<cmd>[A-Za-z]+(?:-[A-Za-z]+)*)
182+
(?P<args>.*)$
183+
''', re.X)
152184
def get_commands(template):
153185
with open(template, 'rUb') as f:
154-
for lineno, line in enumerate(f):
155-
m = LINE_PATTERN.search(line.rstrip('\r\n'))
186+
for lineno, line in concat_multi_lines(f):
187+
m = LINE_PATTERN.search(line)
156188
if not m: continue
157189

158190
negated = (m.group('negated') == '!')

branches/auto/src/test/run-make/rustdoc-where/foo.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ impl<D> Delta<D> where D: MyTrait {
2424
}
2525

2626
pub struct Echo<E>;
27-
// @matches foo/struct.Echo.html '//*[@class="impl"]//code' "impl.*MyTrait.*for.*Echo.*where.*E:.*MyTrait"
28-
// @matches foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' "impl.*MyTrait.*for.*Echo.*where.*E:.*MyTrait"
27+
// @matches foo/struct.Echo.html '//*[@class="impl"]//code' \
28+
// "impl.*MyTrait.*for.*Echo.*where.*E:.*MyTrait"
29+
// @matches foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \
30+
// "impl.*MyTrait.*for.*Echo.*where.*E:.*MyTrait"
2931
impl<E> MyTrait for Echo<E> where E: MyTrait {}
3032

3133
pub enum Foxtrot<F> {}
32-
// @matches foo/enum.Foxtrot.html '//*[@class="impl"]//code' "impl.*MyTrait.*for.*Foxtrot.*where.*F:.*MyTrait"
33-
// @matches foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' "impl.*MyTrait.*for.*Foxtrot.*where.*F:.*MyTrait"
34+
// @matches foo/enum.Foxtrot.html '//*[@class="impl"]//code' \
35+
// "impl.*MyTrait.*for.*Foxtrot.*where.*F:.*MyTrait"
36+
// @matches foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \
37+
// "impl.*MyTrait.*for.*Foxtrot.*where.*F:.*MyTrait"
3438
impl<F> MyTrait for Foxtrot<F> where F: MyTrait {}

0 commit comments

Comments
 (0)