Skip to content

Commit

Permalink
chore: sub and sup
Browse files Browse the repository at this point in the history
  • Loading branch information
kettei-sproutty committed Jan 18, 2024
1 parent 8f60efb commit e232f25
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ authors = ["Alessio Marchi <[email protected]>"]
description = "Converts a docx file to html"
license = "MIT"
edition = "2018"
homepage = "https://scuderia-fe.github.io/docx-to-html/"
keywords = ["docx-to-html", "docx-2-html", "docx", "office", "ms-office"]

[lib]
name = "docx_to_html"
Expand Down
20 changes: 9 additions & 11 deletions src/parser/run.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use docx_rs::{Drawing, DrawingData, Run, RunChild, RunProperty, Text};
use docx_rs::{Drawing, DrawingData, Run, RunChild, RunProperty, Text, VertAlignType};

use crate::{
element::{ElementChildren, ElementTag},
Expand Down Expand Up @@ -82,16 +82,14 @@ pub fn analyze_run_properties(run_properties: &RunProperty) -> RunElement {
}
}

// TODO: superscript and subscript
// if run.run_property.vert_align.is_some() {
// if let Some(val) = &run.run_property.vert_align.as_ref().unwrap().val {
// match val.as_str() {
// "superscript" => element.tags.push(ElementTag::Sup),
// "subscript" => element.tags.push(ElementTag::Sub),
// _ => (),
// }
// }
// };
if let Some(vert_align) = &run_properties.vert_align {
match vert_align.val {
VertAlignType::SuperScript => element.tags.push(ElementTag::Sup),
VertAlignType::SubScript => element.tags.push(ElementTag::Sub),
VertAlignType::Baseline => (),
_ => (),
}
};

element
}
Expand Down

0 comments on commit e232f25

Please sign in to comment.