Implement underline and strikethrough tokens
This commit is contained in:
parent
1faa0d5c3b
commit
0d910634c6
9 changed files with 182 additions and 29 deletions
|
|
@ -15,8 +15,10 @@ pub struct State {
|
|||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Switches {
|
||||
pub oblique: bool,
|
||||
pub bold: bool,
|
||||
pub oblique: bool,
|
||||
pub crossout: bool,
|
||||
pub underline: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
@ -24,21 +26,13 @@ pub struct Buffers {
|
|||
pub anchor: AnchorBuffer,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct AnchorBuffer {
|
||||
pub candidate: Anchor,
|
||||
pub text: String,
|
||||
pub destination: String,
|
||||
}
|
||||
|
||||
impl AnchorBuffer {
|
||||
pub fn clear(&mut self) {
|
||||
self.candidate = Anchor::default();
|
||||
self.text = String::default();
|
||||
self.destination = String::default();
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for AnchorBuffer {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
let display_text = if self.text.is_empty() {
|
||||
|
|
@ -72,8 +66,10 @@ impl Default for State {
|
|||
},
|
||||
dom_ids: HashMap::default(),
|
||||
switches: Switches {
|
||||
oblique: false,
|
||||
bold: false,
|
||||
crossout: false,
|
||||
oblique: false,
|
||||
underline: false,
|
||||
},
|
||||
buffers: Buffers {
|
||||
anchor: AnchorBuffer {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue