File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -168,27 +168,28 @@ impl Preprocessor for Spec {
168
168
169
169
fn run ( & self , _ctx : & PreprocessorContext , mut book : Book ) -> Result < Book , Error > {
170
170
let mut found_rules = BTreeMap :: new ( ) ;
171
- for section in & mut book. sections {
172
- let BookItem :: Chapter ( ch) = section else {
173
- continue ;
171
+ book. for_each_mut ( |item| {
172
+ let BookItem :: Chapter ( ch) = item else {
173
+ return ;
174
174
} ;
175
175
if ch. is_draft_chapter ( ) {
176
- continue ;
176
+ return ;
177
177
}
178
178
ch. content = self . rule_definitions ( & ch, & mut found_rules) ;
179
179
ch. content = self . admonitions ( & ch) ;
180
180
ch. content = std_links:: std_links ( & ch) ;
181
- }
182
- for section in & mut book. sections {
183
- let BookItem :: Chapter ( ch) = section else {
184
- continue ;
181
+ } ) ;
182
+ // This is a separate pass because it relies on the modifications of
183
+ // the previous passes.
184
+ book. for_each_mut ( |item| {
185
+ let BookItem :: Chapter ( ch) = item else {
186
+ return ;
185
187
} ;
186
188
if ch. is_draft_chapter ( ) {
187
- continue ;
189
+ return ;
188
190
}
189
191
ch. content = self . auto_link_references ( & ch, & found_rules) ;
190
- }
191
-
192
+ } ) ;
192
193
Ok ( book)
193
194
}
194
195
}
You can’t perform that action at this time.
0 commit comments