chore: reorganize directories

This commit is contained in:
PoiScript 2024-03-06 15:20:40 +08:00
parent 42cb1d21bd
commit 14d1555fc1
No known key found for this signature in database
GPG key ID: 22C2B1249D99985E
88 changed files with 114 additions and 144 deletions

20
src/ast/fixed_width.rs Normal file
View file

@ -0,0 +1,20 @@
use crate::SyntaxKind;
use super::{filter_token, FixedWidth};
impl FixedWidth {
/// Contents without colons prefix
///
/// ```rust
/// use orgize::{ast::FixedWidth, Org};
///
/// let fixed = Org::parse(": A\n:\n: B\n: C").first_node::<FixedWidth>().unwrap();
/// assert_eq!(fixed.value(), "A\n\nB\nC");
/// ```
pub fn value(&self) -> String {
self.syntax
.children_with_tokens()
.filter_map(filter_token(SyntaxKind::TEXT))
.fold(String::new(), |acc, text| acc + &text)
}
}