Compare commits
No commits in common. "1947ae9f22f1e634925eeb4dc1d830debd041aa1" and "68fac7cfe8ebdb86005dc8c2885d2b618b05b520" have entirely different histories.
1947ae9f22
...
68fac7cfe8
@ -1,5 +0,0 @@
|
|||||||
* baz
|
|
||||||
# lorem
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,6 +0,0 @@
|
|||||||
* baz
|
|
||||||
# lorem
|
|
||||||
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,4 +0,0 @@
|
|||||||
* baz
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,5 +0,0 @@
|
|||||||
* baz
|
|
||||||
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,13 +0,0 @@
|
|||||||
* baz
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# lorem
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,19 +0,0 @@
|
|||||||
:PROPERTIES:
|
|
||||||
:foo: bar
|
|
||||||
:foo+: baz
|
|
||||||
:cat: dog
|
|
||||||
:END:
|
|
||||||
|
|
||||||
# Even though these are inheriting the properties and overwriting and/or appending to them, this is not represented in the parser AST so Organic does not do any special handling of this.
|
|
||||||
|
|
||||||
* Overwrite
|
|
||||||
:PROPERTIES:
|
|
||||||
:foo: lorem
|
|
||||||
:bat: car
|
|
||||||
:END:
|
|
||||||
|
|
||||||
* Append
|
|
||||||
:PROPERTIES:
|
|
||||||
:foo+: ipsum
|
|
||||||
:cake: lie
|
|
||||||
:END:
|
|
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Blank lines and comments can come before property drawers in the zeroth section
|
||||||
|
:PROPERTIES:
|
||||||
|
:FOO: bar
|
||||||
|
:END:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Spaces turn property drawers into regular drawers
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:FOO: bar
|
||||||
|
:END:
|
||||||
|
* Comments turn property drawers into regular drawers
|
||||||
|
# Comment
|
||||||
|
:PROPERTIES:
|
||||||
|
:FOO: bar
|
||||||
|
:END:
|
||||||
|
* Baseline
|
||||||
|
:PROPERTIES:
|
||||||
|
:FOO: bar
|
||||||
|
:END:
|
@ -1,4 +0,0 @@
|
|||||||
# lorem
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,5 +0,0 @@
|
|||||||
# lorem
|
|
||||||
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,3 +0,0 @@
|
|||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -1,12 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# lorem
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:PROPERTIES:
|
|
||||||
:FOO: bar
|
|
||||||
:END:
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Blank lines and comments can come before property drawers in the zeroth section
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:FOO: bar
|
||||||
|
:END:
|
@ -455,27 +455,6 @@ fn _compare_document<'b, 's>(
|
|||||||
let mut child_status = Vec::new();
|
let mut child_status = Vec::new();
|
||||||
let mut message = None;
|
let mut message = None;
|
||||||
|
|
||||||
let additional_property_names: Vec<String> = rust
|
|
||||||
.get_additional_properties()
|
|
||||||
.map(|node_property| format!(":{}", node_property.property_name.to_uppercase()))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let additional_properties: Vec<(String, &str)> = rust
|
|
||||||
.get_additional_properties()
|
|
||||||
.map(|node_property| {
|
|
||||||
(
|
|
||||||
format!(":{}", node_property.property_name.to_uppercase()),
|
|
||||||
node_property.value.unwrap_or(""),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
compare_additional_properties(emacs, additional_properties.into_iter())?.apply(
|
|
||||||
&mut child_status,
|
|
||||||
&mut this_status,
|
|
||||||
&mut message,
|
|
||||||
);
|
|
||||||
|
|
||||||
compare_children_iter(
|
compare_children_iter(
|
||||||
source,
|
source,
|
||||||
emacs,
|
emacs,
|
||||||
@ -489,10 +468,6 @@ fn _compare_document<'b, 's>(
|
|||||||
source,
|
source,
|
||||||
emacs,
|
emacs,
|
||||||
rust,
|
rust,
|
||||||
additional_property_names
|
|
||||||
.iter()
|
|
||||||
.map(String::as_str)
|
|
||||||
.map(EmacsField::Required),
|
|
||||||
(
|
(
|
||||||
EmacsField::Required(":path"),
|
EmacsField::Required(":path"),
|
||||||
|r| r.path.as_ref().map(|p| p.to_str()).flatten(),
|
|r| r.path.as_ref().map(|p| p.to_str()).flatten(),
|
||||||
|
@ -93,7 +93,8 @@ impl<'s> Heading<'s> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_additional_properties(&self) -> impl Iterator<Item = &NodeProperty<'s>> {
|
pub fn get_additional_properties(&self) -> impl Iterator<Item = &NodeProperty<'s>> {
|
||||||
self.children
|
let foo = self
|
||||||
|
.children
|
||||||
.iter()
|
.iter()
|
||||||
.take(1)
|
.take(1)
|
||||||
.filter_map(|c| match c {
|
.filter_map(|c| match c {
|
||||||
@ -106,28 +107,7 @@ impl<'s> Heading<'s> {
|
|||||||
Element::PropertyDrawer(property_drawer) => Some(property_drawer),
|
Element::PropertyDrawer(property_drawer) => Some(property_drawer),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.flat_map(|property_drawer| property_drawer.children.iter())
|
.flat_map(|property_drawer| property_drawer.children.iter());
|
||||||
}
|
foo
|
||||||
}
|
|
||||||
|
|
||||||
impl<'s> Document<'s> {
|
|
||||||
pub fn get_additional_properties(&self) -> impl Iterator<Item = &NodeProperty<'s>> {
|
|
||||||
let zeroth_section_children = self
|
|
||||||
.zeroth_section
|
|
||||||
.iter()
|
|
||||||
.flat_map(|zeroth_section| zeroth_section.children.iter());
|
|
||||||
let property_drawer = zeroth_section_children
|
|
||||||
.take_while(|element| match element {
|
|
||||||
Element::Comment(_) => true,
|
|
||||||
Element::PropertyDrawer(_) => true,
|
|
||||||
_ => false,
|
|
||||||
})
|
|
||||||
.find_map(|element| match element {
|
|
||||||
Element::PropertyDrawer(property_drawer) => Some(property_drawer),
|
|
||||||
_ => None,
|
|
||||||
});
|
|
||||||
property_drawer
|
|
||||||
.into_iter()
|
|
||||||
.flat_map(|property_drawer| property_drawer.children.iter())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user