Struct outline::parser::html::HtmlParser
source · pub struct HtmlParser {
pub code_tag: String,
pub language_attribute: String,
pub name_attribute: String,
pub block_class: String,
pub language_class: String,
pub comments_as_aside: bool,
pub default_language: Option<String>,
pub comment_start: String,
pub interpolation_start: String,
pub interpolation_end: String,
pub macro_start: String,
pub macro_end: String,
}
Expand description
The config for parsing an HTML document
Fields
code_tag: String
The tag that code is written in when parsing. When printing, the code is always rendered in
<pre><code></code></pre>
, as is recommended by W3C.
Default: code
language_attribute: String
The attribute to put the language name when rendering the documentation.
Default: data-language
When parsing, the language is always read from the language
attribute (this value is
ignored).
name_attribute: String
The attribute to add to the code_tag
with the code block’s name .
Default: data-name
When parsing, the name is always read from the name
attribute (this value is ignored)
block_class: String
A class to add to the <pre>
container for any parsed blocks of code when rendering.
language_class: String
The class to add to the <code>
block when rendering. The string {}
is replaced with the
language that this block is in.
Default: language-{}
comments_as_aside: bool
Parsed comments are stripped from the code and written to an <aside></aside>
block after
the code when printing. If false, the comments are just written back into the code.
Default: false
default_language: Option<String>
The language to set if there was no automatically detected language. Optional
comment_start: String
The sequence to identify a comment which should be omitted from the compiled code, and may
be rendered as an <aside>
if comments_as_aside
is set.
Default: //
interpolation_start: String
The sequence to identify the start of a meta variable interpolation.
Default: @{
interpolation_end: String
The sequence to identify the end of a meta variable interpolation.
Default: }
macro_start: String
The sequence to identify the start of a macro invocation.
Default: ==>
macro_end: String
The sequence to identify the end of a macro invocation.
Default: .
Implementations
sourceimpl HtmlParser
impl HtmlParser
sourcepub fn for_language(language: String) -> Self
pub fn for_language(language: String) -> Self
Creates a default parser with a fallback language
sourcepub fn default_language(&self, language: Option<String>) -> Self
pub fn default_language(&self, language: Option<String>) -> Self
Sets the default language of this parser (or does nothing if None
is passed)
Trait Implementations
sourceimpl Clone for HtmlParser
impl Clone for HtmlParser
sourcefn clone(&self) -> HtmlParser
fn clone(&self) -> HtmlParser
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for HtmlParser
impl Debug for HtmlParser
sourceimpl Default for HtmlParser
impl Default for HtmlParser
sourceimpl<'de> Deserialize<'de> for HtmlParser
impl<'de> Deserialize<'de> for HtmlParser
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl Parser for HtmlParser
impl Parser for HtmlParser
sourcefn parse<'a>(&self, input: &'a str) -> Result<Document<'a>, Self::Error>
fn parse<'a>(&self, input: &'a str) -> Result<Document<'a>, Self::Error>
sourcefn parse_name<'a>(
&self,
input: &'a str
) -> Result<(String, Vec<&'a str>), ParseError>
fn parse_name<'a>(
&self,
input: &'a str
) -> Result<(String, Vec<&'a str>), ParseError>
sourcefn parse_line<'a>(
&self,
line_number: usize,
input: &'a str
) -> Result<Line<'a>, ParseError>
fn parse_line<'a>(
&self,
line_number: usize,
input: &'a str
) -> Result<Line<'a>, ParseError>
Line
object