diff options
Diffstat (limited to 'src/document_tree/extra_attributes.rs')
| -rw-r--r-- | src/document_tree/extra_attributes.rs | 23 | 
1 files changed, 17 insertions, 6 deletions
| diff --git a/src/document_tree/extra_attributes.rs b/src/document_tree/extra_attributes.rs index c926113..0aa40f8 100644 --- a/src/document_tree/extra_attributes.rs +++ b/src/document_tree/extra_attributes.rs @@ -9,6 +9,14 @@ pub trait ExtraAttributes<A> {  	fn extra_mut(&mut self) -> &mut A;  } +/* +macro_rules! skip { +	(Option<$type:ty>) => { #[serde(skip_serializing_if = "Option::is_none")] }; +	(Vec   <$type:ty>) => { #[serde(skip_serializing_if = "Vec::is_empty"  )] }; +	(bool            ) => { #[serde(skip_serializing_if = "Not::not"       )] }; +} +*/ +  macro_rules! impl_extra {  	( $name:ident { $( $(#[$pattr:meta])* $param:ident : $type:ty ),* $(,)* } ) => (  		impl_extra!( @@ -18,16 +26,18 @@ macro_rules! impl_extra {  	);  	( $(#[$attr:meta])+ $name:ident { $( $(#[$pattr:meta])* $param:ident : $type:ty ),* $(,)* } ) => (  		$(#[$attr])+ -		pub struct $name { -			$( $(#[$pattr])* pub $param : $type, )* -		} +		pub struct $name { $( +			$(#[$pattr])* +			// skip!($type) +			pub $param : $type, +		)* }  	);  }  impl_extra!(Address { space: FixedSpace });  impl_extra!(LiteralBlock { space: FixedSpace });  impl_extra!(DoctestBlock { space: FixedSpace }); -impl_extra!(SubstitutionDefinition { ltrim: Option<bool>, rtrim: Option<bool> }); +impl_extra!(SubstitutionDefinition { ltrim: bool, rtrim: bool });  impl_extra!(Comment { space: FixedSpace });  impl_extra!(Target {  	refuri: Option<target::Target>, @@ -47,11 +57,12 @@ impl_extra!(#[derive(Debug,Serialize)] Image {  });  //bools usually are XML yesorno. “auto” however either exists and is set to something random like “1” or doesn’t exist +//does auto actually mean the numbering prefix?  impl_extra!(BulletList { bullet: Option<String> });  impl_extra!(EnumeratedList { enumtype: Option<EnumeratedListType>, prefix: Option<String>, suffix: Option<String> }); -impl_extra!(Footnote { backrefs: Vec<ID>, auto: Option<bool> }); +impl_extra!(Footnote { backrefs: Vec<ID>, auto: bool });  impl_extra!(Citation { backrefs: Vec<ID> });  impl_extra!(SystemMessage { backrefs: Vec<ID>, level: Option<usize>, line: Option<usize>, type_: Option<NameToken> });  impl_extra!(Figure { align: Option<AlignH>, width: Option<usize> }); @@ -65,7 +76,7 @@ impl_extra!(Reference {  	refid: Option<ID>,  	refname: Vec<NameToken>,  }); -impl_extra!(FootnoteReference { refid: Option<ID>, refname: Vec<NameToken>, auto: Option<bool> }); +impl_extra!(FootnoteReference { refid: Option<ID>, refname: Vec<NameToken>, auto: bool });  impl_extra!(CitationReference { refid: Option<ID>, refname: Vec<NameToken> });  impl_extra!(SubstitutionReference { refname: Vec<NameToken> });  impl_extra!(Problematic { refid: Option<ID> }); | 
