|
|
@ -31,7 +31,10 @@ mod filters {
|
|
|
|
use crate::svg::{SVGMeasure, SVGUnit};
|
|
|
|
use crate::svg::{SVGMeasure, SVGUnit};
|
|
|
|
|
|
|
|
|
|
|
|
pub fn kle_font_units(kle_font_units: &usize) -> askama::Result<SVGMeasure> {
|
|
|
|
pub fn kle_font_units(kle_font_units: &usize) -> askama::Result<SVGMeasure> {
|
|
|
|
Ok(SVGMeasure::new((6 + kle_font_units * 2) as f64, SVGUnit::Pixel))
|
|
|
|
Ok(SVGMeasure::new(
|
|
|
|
|
|
|
|
(6 + kle_font_units * 2) as f64,
|
|
|
|
|
|
|
|
SVGUnit::Pixel,
|
|
|
|
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -45,8 +48,14 @@ pub enum Error {
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
|
|
|
|
|
|
|
|
pub fn render_file<P, Q>(input_path: P, output_path: Q) -> Result<()>
|
|
|
|
pub fn render_file<P, Q>(input_path: P, output_path: Q) -> Result<()>
|
|
|
|
where P: AsRef<Path>, Q: AsRef<Path> {
|
|
|
|
where
|
|
|
|
use std::{fs::{self, OpenOptions}, io::Write};
|
|
|
|
P: AsRef<Path>,
|
|
|
|
|
|
|
|
Q: AsRef<Path>,
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
use std::{
|
|
|
|
|
|
|
|
fs::{self, OpenOptions},
|
|
|
|
|
|
|
|
io::Write,
|
|
|
|
|
|
|
|
};
|
|
|
|
let mut file = OpenOptions::new()
|
|
|
|
let mut file = OpenOptions::new()
|
|
|
|
.write(true)
|
|
|
|
.write(true)
|
|
|
|
.truncate(true)
|
|
|
|
.truncate(true)
|
|
|
@ -62,4 +71,4 @@ pub fn render(input: &str) -> Result<String> {
|
|
|
|
keyboard: serde_json::from_str(input)?,
|
|
|
|
keyboard: serde_json::from_str(input)?,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
Ok(document.render()?)
|
|
|
|
Ok(document.render()?)
|
|
|
|
}
|
|
|
|
}
|
|
|
|