pub struct TexParser {
pub code_environment: String,
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 a TeX document
Fields
code_environment: String
The environment used to indicate code.
Default: code
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.
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 TexParser
impl TexParser
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<'de> Deserialize<'de> for TexParser
impl<'de> Deserialize<'de> for TexParser
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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Parser for TexParser
impl Parser for TexParser
sourcefn parse<'a>(&self, input: &'a str) -> Result<Document<'a>, Self::Error>
fn parse<'a>(&self, input: &'a str) -> Result<Document<'a>, Self::Error>
Parses the text part of the document. Should delegate the code section on a line-by-line
basis to the built in code parser. Read more
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>
Parses a macro name, returning the name and the extracted variables
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>
Parses a line as code, returning the parsed
Line
objectsourceimpl ParserConfig for TexParser
impl ParserConfig for TexParser
sourcefn comment_start(&self) -> &str
fn comment_start(&self) -> &str
The token to denote the start of a comment that should be rendered in the documentation.
This may be specified as the actual line comment symbol used by the source language to
exclude all comments from the transpiled file, or it can be a completely separate symbol
to allow for some comments to be left untouched even in the output files. Read more
sourcefn interpolation_start(&self) -> &str
fn interpolation_start(&self) -> &str
The token to denote the start of a meta-variable interpolation
sourcefn interpolation_end(&self) -> &str
fn interpolation_end(&self) -> &str
The token to denote the end of a meta-variable interpolation
sourcefn macro_start(&self) -> &str
fn macro_start(&self) -> &str
The token to denote the start of a macro invocation
sourceimpl Printer for TexParser
impl Printer for TexParser
sourcefn print_text_block<'a>(&self, block: &TextBlock<'a>) -> String
fn print_text_block<'a>(&self, block: &TextBlock<'a>) -> String
Prints a text block
sourcefn print_code_block<'a>(&self, block: &CodeBlock<'a>) -> String
fn print_code_block<'a>(&self, block: &CodeBlock<'a>) -> String
Prints a code block
sourcefn print_name(&self, name: String, vars: &[&str]) -> String
fn print_name(&self, name: String, vars: &[&str]) -> String
Fills a name with its placeholders
sourcefn print_line<'a>(&self, line: &Line<'a>, print_comments: bool) -> String
fn print_line<'a>(&self, line: &Line<'a>, print_comments: bool) -> String
Prints a line of a code block
Auto Trait Implementations
impl RefUnwindSafe for TexParser
impl Send for TexParser
impl Sync for TexParser
impl Unpin for TexParser
impl UnwindSafe for TexParser
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more