Optionally parse footnotes on flag
@@ -99,14 +99,15 @@ struct FirstPass<'a> {
tree: Tree<Item<'a>>,
last_line_blank: bool,
references: HashMap<LinkLabel<'a>, LinkDef<'a>>,
+ options: Options,
}
impl<'a> FirstPass<'a> {
- fn new(text: &'a str) -> FirstPass {
+ fn new(text: &'a str, options: Options) -> FirstPass {
let tree = Tree::new();
let last_line_blank = false;
let references = HashMap::new();
- FirstPass { text, tree, last_line_blank, references }
+ FirstPass { text, tree, last_line_blank, references, options }
}
fn run(mut self) -> (Tree<Item<'a>>, HashMap<LinkLabel<'a>, LinkDef<'a>>) {
@@ -138,6 +139,7 @@ impl<'a> FirstPass<'a> {
}
}
+ if self.options.contains(Options::ENABLE_FOOTNOTES) {
// Footnote definitions of the form
// [^bar]:
// * anything really
@@ -149,6 +151,7 @@ impl<'a> FirstPass<'a> {
line_start = LineStart::new(&self.text[start_ix..]);
}
}
+ }
// Process new containers
loop {
@@ -2244,8 +2247,8 @@ impl<'a> Parser<'a> {
}
#[allow(unused_variables)]
- pub fn new_ext(text: &'a str, opts: Options) -> Parser<'a> {
- let first_pass = FirstPass::new(text);
+ pub fn new_ext(text: &'a str, options: Options) -> Parser<'a> {
+ let first_pass = FirstPass::new(text, options);
let (mut tree, refdefs) = first_pass.run();
tree.reset();
Parser { text, tree, refdefs }
