fix: size reader (#86)
parent
b464873e68
commit
2237ece46d
|
@ -25,15 +25,15 @@ pub fn read_indent(attrs: &[OwnedAttribute]) -> ReadIndentResult {
|
||||||
for a in attrs {
|
for a in attrs {
|
||||||
let local_name = &a.name.local_name;
|
let local_name = &a.name.local_name;
|
||||||
if local_name == "left" || local_name == "start" {
|
if local_name == "left" || local_name == "start" {
|
||||||
start = Some(i32::from_str(&a.value)?);
|
start = Some(f64::from_str(&a.value)? as i32);
|
||||||
} else if local_name == "leftChars" || local_name == "startChars" {
|
} else if local_name == "leftChars" || local_name == "startChars" {
|
||||||
start_chars = Some(i32::from_str(&a.value)?);
|
start_chars = Some(i32::from_str(&a.value)?);
|
||||||
} else if local_name == "end" || local_name == "right" {
|
} else if local_name == "end" || local_name == "right" {
|
||||||
end = Some(i32::from_str(&a.value)?);
|
end = Some(f64::from_str(&a.value)? as i32);
|
||||||
} else if local_name == "hanging" {
|
} else if local_name == "hanging" {
|
||||||
special = Some(SpecialIndentType::Hanging(i32::from_str(&a.value)?))
|
special = Some(SpecialIndentType::Hanging(f64::from_str(&a.value)? as i32))
|
||||||
} else if local_name == "firstLine" {
|
} else if local_name == "firstLine" {
|
||||||
special = Some(SpecialIndentType::FirstLine(i32::from_str(&a.value)?))
|
special = Some(SpecialIndentType::FirstLine(f64::from_str(&a.value)? as i32))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ pub enum ReaderError {
|
||||||
ZipError(#[from] zip::result::ZipError),
|
ZipError(#[from] zip::result::ZipError),
|
||||||
#[error("Failed to parse int.")]
|
#[error("Failed to parse int.")]
|
||||||
NumError(#[from] std::num::ParseIntError),
|
NumError(#[from] std::num::ParseIntError),
|
||||||
|
#[error("Failed to parse float.")]
|
||||||
|
FloatError(#[from] std::num::ParseFloatError),
|
||||||
#[error("Failed to convert type.")]
|
#[error("Failed to convert type.")]
|
||||||
TypeError(#[from] crate::types::TypeError),
|
TypeError(#[from] crate::types::TypeError),
|
||||||
#[error("Failed to read xml.")]
|
#[error("Failed to read xml.")]
|
||||||
|
|
Loading…
Reference in New Issue