pub enum CommentItem {
}
Expand description
A comment markup item, which represents either a piece of text from the input or some kind of metadata item like the start or end of an italicized group.
Variants§
Text(Span)
A piece of regular text. The characters in the buffer at the given
span should be interpreted literally, except for the escapes.
Use unescape_text
to strip the text escapes [
, ~
, `
, and _
.
Note that [
and _
can also appear unescaped.
LineBreak(usize)
A paragraph break, caused by two or more consecutive newlines in the input.
This is a zero-length item (all characters will be present in Text
nodes
before and after the element), but corresponds roughly to a <p>
tag in HTML.
StartMathMode(usize)
Start math mode, indicated by a backtick character. The usize points to the character.
Between CommentItem::StartMathMode
and CommentItem::EndMathMode
,
there will be no comment items other than CommentItem::MathToken
.
EndMathMode(usize)
End math mode, indicated by a backtick character. The usize points to the character.
Between CommentItem::StartMathMode
and CommentItem::EndMathMode
,
there will be no comment items other than CommentItem::MathToken
.
MathToken(Span)
A single math token. After unescaping this should correspond to a $c
or $v
statement
in the database.
Use unescape_math
to strip the escape character `
.
Label(usize, Span)
A label of an existing theorem. The usize
points to the ~
character.
Use unescape_text
to strip the text escapes [
, ~
, `
, and _
.
Note that [
, ~
, _
can also appear unescaped.
Url(usize, Span)
A link to a web site URL. The usize
points to the ~
character.
Use unescape_text
to strip the text escapes [
, ~
, `
, and _
.
Note that [
, ~
, _
can also appear unescaped.
StartHtml(usize)
The <HTML>
keyword, which starts HTML mode
(it doesn’t actually put <HTML>
in the output).
In HTML mode subscripts and italics are disabled, and HTML markup is interpreted.
EndHtml(usize)
The </HTML>
keyword, which ends HTML mode
(it doesn’t actually put </HTML>
in the output).
StartSubscript(usize)
The start of a subscript x_0
. The usize
points at the _
character.
EndSubscript(usize)
The end of a subscript like x_0
. The usize
points just after the end of the word.
StartItalic(usize)
The start of an italic section _italic text_
. The usize
points at the _
character.
EndItalic(usize)
The end of an italic section _italic text_
. The usize
points at the _
character.
BibTag(Span)
A bibliographic label [foo]
. No escapes are needed inside the tag body.
Implementations§
Source§impl CommentItem
impl CommentItem
Sourcepub fn unescape_text(html_mode: bool, buf: &[u8], out: &mut Vec<u8>)
pub fn unescape_text(html_mode: bool, buf: &[u8], out: &mut Vec<u8>)
Remove text escapes from a markup segment buf
, generally coming from the
CommentItem::Text
field.
Sourcepub fn unescape_label(buf: &[u8], out: &mut Vec<u8>)
pub fn unescape_label(buf: &[u8], out: &mut Vec<u8>)
Remove text escapes from a markup segment buf
, generally coming from the
CommentItem::Label
or CommentItem::Url
fields.
Sourcepub fn unescape_math(buf: &[u8], out: &mut Vec<u8>)
pub fn unescape_math(buf: &[u8], out: &mut Vec<u8>)
Remove math escapes from a markup segment buf
, generally coming from the
CommentItem::MathToken
field.
Trait Implementations§
Source§impl Clone for CommentItem
impl Clone for CommentItem
Source§fn clone(&self) -> CommentItem
fn clone(&self) -> CommentItem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CommentItem
impl Debug for CommentItem
Source§impl PartialEq for CommentItem
impl PartialEq for CommentItem
impl Copy for CommentItem
impl Eq for CommentItem
impl StructuralPartialEq for CommentItem
Auto Trait Implementations§
impl Freeze for CommentItem
impl RefUnwindSafe for CommentItem
impl Send for CommentItem
impl Sync for CommentItem
impl Unpin for CommentItem
impl UnwindSafe for CommentItem
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more