diff options
| author | Philipp A | 2019-12-08 17:27:38 +0100 |
|---|---|---|
| committer | Philipp A | 2019-12-08 17:27:38 +0100 |
| commit | f1c1422d0ae17f46999735bbb787cca188ecfa54 (patch) | |
| tree | 3118224b302f65cdc6d1c9d08a86b07f0b00f3fb /src/parser | |
| parent | b465cfceb7600ccf6158451a396d5c7afc2138e9 (diff) | |
| download | rust-rst-f1c1422d0ae17f46999735bbb787cca188ecfa54.tar.bz2 | |
render newlines to spaces
Diffstat (limited to 'src/parser')
| -rw-r--r-- | src/parser/conversion/inline.rs | 1 | ||||
| -rw-r--r-- | src/parser/tests.rs | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/parser/conversion/inline.rs b/src/parser/conversion/inline.rs index 297680a..bdabbf0 100644 --- a/src/parser/conversion/inline.rs +++ b/src/parser/conversion/inline.rs @@ -21,6 +21,7 @@ use super::whitespace_normalize_name; pub fn convert_inline(pair: Pair<Rule>) -> Result<c::TextOrInlineElement, Error> { Ok(match pair.as_rule() { Rule::str | Rule::str_nested => pair.as_str().into(), + Rule::ws_newline => " ".to_owned().into(), Rule::reference => convert_reference(pair)?, Rule::substitution_ref => convert_substitution_ref(pair)?.into(), Rule::emph => e::Emphasis::with_children(convert_inlines(pair)?).into(), diff --git a/src/parser/tests.rs b/src/parser/tests.rs index e161108..bad818e 100644 --- a/src/parser/tests.rs +++ b/src/parser/tests.rs @@ -161,7 +161,10 @@ A |subst| in-line ]), substitution_def(53, 101, [ substitution_name(57, 63), - replace(65, 101, [ paragraph(74, 101, [str(74, 86), str(88, 100)]) ]), + replace(65, 101, [ paragraph(74, 101, [ + str(74, 86), ws_newline(86, 87), + str(88, 100), + ]) ]), ]), ] }; @@ -222,8 +225,8 @@ paragraph bullet_item(21, 131, [ line(24, 31, [ str(24, 30) ]), paragraph(34, 74, [ - str(34, 43), - str(47, 58), + str(34, 43), ws_newline(43, 44), + str(47, 58), ws_newline(58, 59), str(62, 73), ]), bullet_list(77, 131, [ |
