-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e232f25
commit 4e3875e
Showing
10 changed files
with
103 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use docx_rs::{RunProperty, Style}; | ||
|
||
fn analyze_run_properties(run_properties: &RunProperty) -> Vec<String> { | ||
let mut accumulator: Vec<String> = vec![]; | ||
|
||
if run_properties.bold.is_some() { | ||
accumulator.push("font-weight: bold".to_owned()); | ||
}; | ||
|
||
if run_properties.italic.is_some() { | ||
accumulator.push("font-style: italic".to_owned()); | ||
}; | ||
|
||
if run_properties.underline.is_some() { | ||
accumulator.push("text-decoration: underline".to_owned()); | ||
}; | ||
|
||
if run_properties.sz.is_some() { | ||
accumulator.push(format!( | ||
"font-size: {}px", | ||
run_properties.sz.as_ref().unwrap().val | ||
)); | ||
}; | ||
|
||
if run_properties.strike.is_some() { | ||
accumulator.push("text-decoration: line-through".to_owned()); | ||
}; | ||
|
||
if run_properties.vanish.is_some() { | ||
accumulator.push("visibility: hidden".to_owned()); | ||
}; | ||
|
||
accumulator | ||
} | ||
|
||
pub fn analyze_style(style: &Style) -> Vec<String> { | ||
let mut accumulator: Vec<String> = vec![]; | ||
|
||
accumulator.append(&mut analyze_run_properties(&style.run_property)); | ||
|
||
return accumulator; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters