Retain labels stays a boolean without -r.
This commit is contained in:
parent
da5dcd4c1b
commit
13163f2468
@ -0,0 +1,3 @@
|
|||||||
|
#+begin_example foo -k
|
||||||
|
bar
|
||||||
|
#+end_example
|
@ -1626,7 +1626,7 @@ fn compare_example_block<'b, 's>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compare retain-labels
|
// Compare retain-labels
|
||||||
// retain-labels is t by default, nil if -r is set, or a number if -k is set.
|
// retain-labels is t by default, nil if -r is set, or a number if -k and -r is set.
|
||||||
let retain_labels = get_property_unquoted_atom(emacs, ":retain-labels")?;
|
let retain_labels = get_property_unquoted_atom(emacs, ":retain-labels")?;
|
||||||
if let Some(retain_labels) = retain_labels {
|
if let Some(retain_labels) = retain_labels {
|
||||||
if retain_labels == "t" {
|
if retain_labels == "t" {
|
||||||
@ -1652,7 +1652,6 @@ fn compare_example_block<'b, 's>(
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// foo
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match rust.retain_labels {
|
match rust.retain_labels {
|
||||||
|
@ -351,6 +351,7 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitc
|
|||||||
let mut retain_labels = RetainLabels::Yes;
|
let mut retain_labels = RetainLabels::Yes;
|
||||||
let mut use_labels = true;
|
let mut use_labels = true;
|
||||||
let mut label_format = None;
|
let mut label_format = None;
|
||||||
|
let mut saw_r = false;
|
||||||
let (remaining, (source, (words, _))) =
|
let (remaining, (source, (words, _))) =
|
||||||
consumed(tuple((separated_list1(space1, switch_word), space0)))(input)?;
|
consumed(tuple((separated_list1(space1, switch_word), space0)))(input)?;
|
||||||
|
|
||||||
@ -366,6 +367,7 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitc
|
|||||||
state = SwitchState::ContinuedLineNumber;
|
state = SwitchState::ContinuedLineNumber;
|
||||||
}
|
}
|
||||||
(SwitchState::Normal, "-r") => {
|
(SwitchState::Normal, "-r") => {
|
||||||
|
saw_r = true;
|
||||||
use_labels = false;
|
use_labels = false;
|
||||||
match retain_labels {
|
match retain_labels {
|
||||||
RetainLabels::Yes => {
|
RetainLabels::Yes => {
|
||||||
@ -378,6 +380,7 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitc
|
|||||||
state = SwitchState::LabelFormat;
|
state = SwitchState::LabelFormat;
|
||||||
}
|
}
|
||||||
(SwitchState::Normal, "-k") => {
|
(SwitchState::Normal, "-k") => {
|
||||||
|
use_labels = false;
|
||||||
let text_until_flag = input.get_until(word);
|
let text_until_flag = input.get_until(word);
|
||||||
let character_offset = Into::<&str>::into(text_until_flag).chars().count();
|
let character_offset = Into::<&str>::into(text_until_flag).chars().count();
|
||||||
let character_offset = CharOffsetInLine::try_from(character_offset)
|
let character_offset = CharOffsetInLine::try_from(character_offset)
|
||||||
@ -426,6 +429,11 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let retain_labels = match retain_labels {
|
||||||
|
RetainLabels::Keep(_) if !saw_r => RetainLabels::Yes,
|
||||||
|
_ => retain_labels,
|
||||||
|
};
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
remaining,
|
remaining,
|
||||||
ExampleSwitches {
|
ExampleSwitches {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user