fix: newline in not allowed in property name
This commit is contained in:
parent
13ebef05d2
commit
5bc15d80ff
4 changed files with 23 additions and 8 deletions
|
|
@ -2,7 +2,7 @@ use rowan::ast::AstNode;
|
|||
|
||||
use crate::Org;
|
||||
|
||||
use super::{Document, Keyword};
|
||||
use super::{Document, Keyword, PropertyDrawer};
|
||||
|
||||
impl Document {
|
||||
/// Returns an iterator of keywords in zeroth section
|
||||
|
|
@ -55,6 +55,24 @@ impl Document {
|
|||
Some(s)
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns top-level properties drawer
|
||||
///
|
||||
/// ```rust
|
||||
/// use orgize::{Org, ast::Document};
|
||||
///
|
||||
/// let org = Org::parse(r#":PROPERTIES:
|
||||
/// :ID: 20220718T085035.042592
|
||||
/// :END:
|
||||
/// #+TITLE: Complete Computing"#);
|
||||
///
|
||||
/// let properties = org.document().properties().unwrap();
|
||||
/// assert_eq!(properties.to_hash_map().len(), 1);
|
||||
/// assert_eq!(properties.get("ID").unwrap(), "20220718T085035.042592");
|
||||
/// ```
|
||||
pub fn properties(&self) -> Option<PropertyDrawer> {
|
||||
rowan::ast::support::child(&self.syntax)
|
||||
}
|
||||
}
|
||||
|
||||
impl Org {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue