Expand description
The main bbcode system. You create this to parse bbcode! Inexpensive clones, since fields are all reference counted.
Fields§
§matchers: Arc<Vec<MatchInfo>>Supply this!
Implementations§
source§impl BBCode
impl BBCode
sourcepub fn default() -> Result<Self, Error>
pub fn default() -> Result<Self, Error>
Get a default bbcode parser. Should hopefully have reasonable defaults!
pub fn from_matchers(matchers: Vec<MatchInfo>) -> Self
sourcepub fn html_escapes() -> Vec<(&'static str, &'static str)> ⓘ
pub fn html_escapes() -> Vec<(&'static str, &'static str)> ⓘ
The basic direct replacement escapes for HTML. You don’t need these if you’re using ‘basics()’
Get a vector of the basic taginfos of bbcode. You don’t need this if you’re using ‘basics()’
If you have extra tags you want to add, use this function to turn the basic definitions into a vector of real MatchInfo for use in the bbcode system
sourcepub fn basics() -> Result<Vec<MatchInfo>, Error>
pub fn basics() -> Result<Vec<MatchInfo>, Error>
Get a vector of ALL basic matchers! This is the function you want to call to get a vector for the bbcode generator!
sourcepub fn extras() -> Result<Vec<MatchInfo>, Error>
pub fn extras() -> Result<Vec<MatchInfo>, Error>
Some fancy extra bbcode. Does not include basics! These are nonstandard, you don’t have to use them!
sourcepub fn parse(&self, input: &str) -> String
pub fn parse(&self, input: &str) -> String
Main function! You call this to parse your raw bbcode! It also escapes html stuff so it can be used raw! Current version keeps newlines as-is and it’s expected you use pre-wrap, later there may be modes for more standard implementations
sourcepub fn parse_profiled_opt(&mut self, input: &str, _name: String) -> String
pub fn parse_profiled_opt(&mut self, input: &str, _name: String) -> String
This MAY OR MAY NOT profile, depending on your featureset!