Skip to content

Commit

Permalink
Fix grouping, respect locale
Browse files Browse the repository at this point in the history
  • Loading branch information
reknih committed Oct 19, 2023
1 parent d24d69a commit e57f6ab
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 64 deletions.
18 changes: 9 additions & 9 deletions src/csl/elem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ impl Elem {
format: BufWriteFormat,
) -> Result<(), fmt::Error> {
match (format, self.display) {
(BufWriteFormat::HTML, Some(Display::Block)) => w.write_str("<div>")?,
(BufWriteFormat::HTML, Some(Display::Indent)) => {
(BufWriteFormat::Html, Some(Display::Block)) => w.write_str("<div>")?,
(BufWriteFormat::Html, Some(Display::Indent)) => {
w.write_str("<div style=\"padding-left: 4em;\">")?
}
(BufWriteFormat::HTML, Some(Display::LeftMargin)) => {
(BufWriteFormat::Html, Some(Display::LeftMargin)) => {
w.write_str("<div style=\"float: left;\">")?
}
(BufWriteFormat::HTML, Some(Display::RightInline)) => {
(BufWriteFormat::Html, Some(Display::RightInline)) => {
w.write_str("<div style=\"float: right; clear: both;\">")?
}
(_, Some(Display::Block)) => w.write_char('\n')?,
Expand All @@ -57,7 +57,7 @@ impl Elem {
}

match (format, self.display) {
(BufWriteFormat::HTML, Some(_)) => w.write_str("</div>")?,
(BufWriteFormat::Html, Some(_)) => w.write_str("</div>")?,
(_, Some(Display::Block)) => w.write_char('\n')?,
(_, _) => {}
}
Expand Down Expand Up @@ -255,7 +255,7 @@ impl ElemChild {
}
ElemChild::Elem(e) => e.write_buf(w, format),
ElemChild::Markup(m) => w.write_str(m),
ElemChild::Link { text, url } if format == BufWriteFormat::HTML => {
ElemChild::Link { text, url } if format == BufWriteFormat::Html => {
w.write_str("<a href=\"")?;
w.write_str(url)?;
w.write_str("\">")?;
Expand Down Expand Up @@ -322,7 +322,7 @@ pub enum BufWriteFormat {
/// Write with terminal colors.
VT100,
/// Write HTML.
HTML,
Html,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -480,7 +480,7 @@ impl Formatting {
match format {
BufWriteFormat::Plain => Ok(()),
BufWriteFormat::VT100 => self.write_vt100(buf),
BufWriteFormat::HTML => {
BufWriteFormat::Html => {
let is_default = self == &Formatting::default();
if !is_default {
buf.write_str("<span style=\"")?;
Expand All @@ -500,7 +500,7 @@ impl Formatting {
match format {
BufWriteFormat::Plain => Ok(()),
BufWriteFormat::VT100 => buf.write_str("\x1b[0m"),
BufWriteFormat::HTML => {
BufWriteFormat::Html => {
let is_default = self == &Formatting::default();
if !is_default {
buf.write_str("</span>")?;
Expand Down
Loading

0 comments on commit e57f6ab

Please sign in to comment.