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 {
168168
169169 fn run ( & self , _ctx : & PreprocessorContext , mut book : Book ) -> Result < Book , Error > {
170170 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 ;
174174 } ;
175175 if ch. is_draft_chapter ( ) {
176- continue ;
176+ return ;
177177 }
178178 ch. content = self . rule_definitions ( & ch, & mut found_rules) ;
179179 ch. content = self . admonitions ( & ch) ;
180180 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 ;
185187 } ;
186188 if ch. is_draft_chapter ( ) {
187- continue ;
189+ return ;
188190 }
189191 ch. content = self . auto_link_references ( & ch, & found_rules) ;
190- }
191-
192+ } ) ;
192193 Ok ( book)
193194 }
194195}
You can’t perform that action at this time.
0 commit comments