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§
Source§impl 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§
Source§impl<'de> Deserialize<'de> for TexParser
impl<'de> Deserialize<'de> for TexParser
Source§fn 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
Source§impl Parser for TexParser
impl Parser for TexParser
Source§fn 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.
Source§fn 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
Source§fn 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
objectSource§impl ParserConfig for TexParser
impl ParserConfig for TexParser
Source§fn 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.
Source§fn interpolation_start(&self) -> &str
fn interpolation_start(&self) -> &str
The token to denote the start of a meta-variable interpolation
Source§fn interpolation_end(&self) -> &str
fn interpolation_end(&self) -> &str
The token to denote the end of a meta-variable interpolation
Source§fn macro_start(&self) -> &str
fn macro_start(&self) -> &str
The token to denote the start of a macro invocation
Source§impl Printer for TexParser
impl Printer for TexParser
Auto Trait Implementations§
impl Freeze for TexParser
impl RefUnwindSafe for TexParser
impl Send for TexParser
impl Sync for TexParser
impl Unpin for TexParser
impl UnwindSafe for TexParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more