pub enum TagType {
Start,
Simple,
DefinedArg(&'static str),
DefinedTag(&'static str, Option<&'static str>),
SelfClosing(&'static str),
DefaultArg(&'static str),
}Expand description
This is the ‘silly’ part of the parser. Rather than making some actually generic system, I identified some standard ways tags are used and just made code around those ways. Probably bad but oh well.
Variants§
Start
Don’t make tags with this type, it’s for the system! Should ONLY have one of these! It’s like S in a grammar!
Simple
Stuff like [b][/b], no args, normal translation (can change tag name still)
DefinedArg(&'static str)
CAN have argument defined (but optional), attribute name is given in enum
DefinedTag(&'static str, Option<&'static str>)
Some arguments turn into tags! Crazy… (like spoiler creating a “summary” tag)
SelfClosing(&'static str)
No closing tag, value turns into an arg with the name given in the enum
DefaultArg(&'static str)
The tag enclosed value provides a default for the given attribute, or not if defined. Used for [url] etc