Switch to using coalesce_whitespace_escaped for macro args.
This commit is contained in:
parent
17c745ee71
commit
dd009498dd
@ -1,7 +1,7 @@
|
|||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use super::util::coalesce_whitespace;
|
use super::util::coalesce_whitespace_escaped;
|
||||||
use super::util::coalesce_whitespace_if_line_break;
|
use super::util::coalesce_whitespace_if_line_break;
|
||||||
use super::util::remove_line_break;
|
use super::util::remove_line_break;
|
||||||
use super::util::remove_whitespace_if_line_break;
|
use super::util::remove_whitespace_if_line_break;
|
||||||
@ -740,6 +740,8 @@ impl<'s> AngleLink<'s> {
|
|||||||
|
|
||||||
impl<'s> OrgMacro<'s> {
|
impl<'s> OrgMacro<'s> {
|
||||||
pub fn get_macro_args<'b>(&'b self) -> impl Iterator<Item = Cow<'s, str>> + 'b {
|
pub fn get_macro_args<'b>(&'b self) -> impl Iterator<Item = Cow<'s, str>> + 'b {
|
||||||
self.macro_args.iter().map(|arg| coalesce_whitespace(*arg))
|
self.macro_args
|
||||||
|
.iter()
|
||||||
|
.map(|arg| coalesce_whitespace_escaped('\\', |c| ",".contains(c))(*arg))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,6 +201,7 @@ enum CoalesceWhitespaceIfLineBreakState {
|
|||||||
/// Removes all whitespace from a string.
|
/// Removes all whitespace from a string.
|
||||||
///
|
///
|
||||||
/// Example: "foo bar" => "foobar" and "foo \n bar" => "foobar".
|
/// Example: "foo bar" => "foobar" and "foo \n bar" => "foobar".
|
||||||
|
#[allow(dead_code)]
|
||||||
pub(crate) fn coalesce_whitespace<'s>(input: &'s str) -> Cow<'s, str> {
|
pub(crate) fn coalesce_whitespace<'s>(input: &'s str) -> Cow<'s, str> {
|
||||||
let mut state = CoalesceWhitespace::Normal;
|
let mut state = CoalesceWhitespace::Normal;
|
||||||
for (offset, c) in input.char_indices() {
|
for (offset, c) in input.char_indices() {
|
||||||
|
Loading…
Reference in New Issue
Block a user