aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser/conversion/block.rs
diff options
context:
space:
mode:
authorAndreu Botella2019-10-23 09:29:24 +0200
committerPhilipp A2019-10-23 09:29:24 +0200
commit10cc972f2e4b99e6d3082970ee6982bfee5211c0 (patch)
tree038f7199c2a27e89df55d7e15ddea1b1e8781341 /src/parser/conversion/block.rs
parent7d38186a0ae3222b6de9bc91290a87d0e4564e18 (diff)
downloadrust-rst-10cc972f2e4b99e6d3082970ee6982bfee5211c0.tar.bz2
Resolving substitutions. (#9)
Diffstat (limited to 'src/parser/conversion/block.rs')
-rw-r--r--src/parser/conversion/block.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/parser/conversion/block.rs b/src/parser/conversion/block.rs
index 714b410..9552539 100644
--- a/src/parser/conversion/block.rs
+++ b/src/parser/conversion/block.rs
@@ -6,13 +6,14 @@ use crate::document_tree::{
elements as e,
element_categories as c,
extra_attributes as a,
+ attribute_types as at
};
use crate::parser::{
pest_rst::Rule,
pair_ext_parse::PairExt,
};
-use super::inline::convert_inline;
+use super::{whitespace_normalize_name, inline::convert_inline};
#[derive(PartialEq)]
@@ -92,14 +93,14 @@ fn convert_target(pair: Pair<Rule>) -> Result<e::Target, Error> {
fn convert_substitution_def(pair: Pair<Rule>) -> Result<e::SubstitutionDefinition, Error> {
let mut pairs = pair.into_inner();
- let name = pairs.next().unwrap().as_str(); // Rule::substitution_name
+ let name = whitespace_normalize_name(pairs.next().unwrap().as_str()); // Rule::substitution_name
let inner_pair = pairs.next().unwrap();
let inner: c::TextOrInlineElement = match inner_pair.as_rule() {
Rule::image => convert_image::<e::ImageInline>(inner_pair)?.into(),
rule => panic!("Unknown substitution rule {:?}", rule),
};
let mut subst_def = e::SubstitutionDefinition::with_children(vec![inner]);
- subst_def.names_mut().push(name.into());
+ subst_def.names_mut().push(at::NameToken(name));
Ok(subst_def)
}