Compare commits
No commits in common. "47674a6907483f8face790913916ac5324283c0b" and "5e127fec11cee2d7e27c3c1b1999e0fd25f8ace9" have entirely different histories.
47674a6907
...
5e127fec11
@ -1,7 +1,5 @@
|
|||||||
use super::element::Element;
|
use super::element::Element;
|
||||||
use super::lesser_element::TableCell;
|
use super::lesser_element::TableCell;
|
||||||
use super::macros::ref_getter;
|
|
||||||
use super::macros::simple_getter;
|
|
||||||
use super::Keyword;
|
use super::Keyword;
|
||||||
use super::Object;
|
use super::Object;
|
||||||
use super::StandardProperties;
|
use super::StandardProperties;
|
||||||
@ -25,14 +23,14 @@ pub type IndentationLevel = u16;
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct PlainListItem<'s> {
|
pub struct PlainListItem<'s> {
|
||||||
pub(crate) source: &'s str,
|
pub source: &'s str,
|
||||||
pub(crate) indentation: IndentationLevel,
|
pub indentation: IndentationLevel,
|
||||||
pub(crate) bullet: &'s str,
|
pub bullet: &'s str,
|
||||||
pub(crate) counter: Option<PlainListItemCounter>,
|
pub counter: Option<PlainListItemCounter>,
|
||||||
pub(crate) checkbox: Option<(CheckboxType, &'s str)>,
|
pub checkbox: Option<(CheckboxType, &'s str)>,
|
||||||
pub(crate) tag: Vec<Object<'s>>,
|
pub tag: Vec<Object<'s>>,
|
||||||
pub(crate) pre_blank: PlainListItemPreBlank,
|
pub pre_blank: PlainListItemPreBlank,
|
||||||
pub(crate) children: Vec<Element<'s>>,
|
pub children: Vec<Element<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PlainListItemCounter = u16;
|
pub type PlainListItemCounter = u16;
|
||||||
@ -159,29 +157,3 @@ impl<'s> StandardProperties<'s> for TableRow<'s> {
|
|||||||
self.source
|
self.source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s> PlainListItem<'s> {
|
|
||||||
simple_getter!(get_indentation_level, indentation, IndentationLevel);
|
|
||||||
simple_getter!(
|
|
||||||
/// Get the bullet
|
|
||||||
///
|
|
||||||
/// Example output: "1. "
|
|
||||||
get_bullet,
|
|
||||||
bullet,
|
|
||||||
&'s str
|
|
||||||
);
|
|
||||||
simple_getter!(get_counter, counter, Option<PlainListItemCounter>);
|
|
||||||
simple_getter!(get_pre_blank, pre_blank, PlainListItemPreBlank);
|
|
||||||
ref_getter!(get_tag, tag, Vec<Object<'s>>);
|
|
||||||
ref_getter!(get_children, children, Vec<Element<'s>>);
|
|
||||||
|
|
||||||
pub fn get_checkbox(&self) -> Option<&'s str> {
|
|
||||||
self.checkbox.as_ref().map(|(_, checkbox)| *checkbox)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_checkbox_type(&self) -> Option<&CheckboxType> {
|
|
||||||
self.checkbox
|
|
||||||
.as_ref()
|
|
||||||
.map(|(checkbox_type, _)| checkbox_type)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
// TODO: Would be nice if I didn't have to specify a function name but it looks like concat_idents!() cannot be used to create an ident.
|
|
||||||
// TODO: Find out if proc macros could do this easier (for example, parsing out the field type)
|
|
||||||
macro_rules! simple_getter {
|
|
||||||
($(#[$meta:meta])* $funcname: ident, $field:ident, $fieldtype:ty) => {
|
|
||||||
$(#[$meta])*
|
|
||||||
pub fn $funcname(&self) -> $fieldtype {
|
|
||||||
self.$field
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
pub(crate) use simple_getter;
|
|
||||||
|
|
||||||
macro_rules! ref_getter {
|
|
||||||
($(#[$meta:meta])* $funcname: ident, $field:ident, $fieldtype:ty) => {
|
|
||||||
$(#[$meta])*
|
|
||||||
pub fn $funcname(&self) -> &$fieldtype {
|
|
||||||
&self.$field
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
pub(crate) use ref_getter;
|
|
@ -3,7 +3,6 @@ mod element;
|
|||||||
mod get_standard_properties;
|
mod get_standard_properties;
|
||||||
mod greater_element;
|
mod greater_element;
|
||||||
mod lesser_element;
|
mod lesser_element;
|
||||||
mod macros;
|
|
||||||
mod object;
|
mod object;
|
||||||
mod source;
|
mod source;
|
||||||
mod standard_properties;
|
mod standard_properties;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user