summaryrefslogtreecommitdiff
path: root/src/doc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc.rs')
-rw-r--r--src/doc.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/doc.rs b/src/doc.rs
index f3f9641..07831c2 100644
--- a/src/doc.rs
+++ b/src/doc.rs
@@ -155,11 +155,23 @@ impl Document {
let mut css = Element::new(ElementTag::Style);
css.push_child(Content::Text(CSS.into()));
+ for css_file in self.meta.css_embed() {
+ css.push_child(Content::Text(css_file.into()));
+ }
head.push_child(Content::Elt(css));
+ for css_url in self.meta.css_urls() {
+ let mut link = Element::new(ElementTag::Link);
+ link.push_attribute(Attribute::new("rel", "stylesheet"));
+ link.push_attribute(Attribute::new("type", "text/css"));
+ link.push_attribute(Attribute::new("href", css_url));
+ head.push_child(Content::Elt(link));
+ }
+
self.meta.set_date(date.into());
let mut body_content = Element::new(crate::html::ElementTag::Div);
+ body_content.push_attribute(Attribute::new("class", "content"));
for md in self.markdowns.iter() {
body_content.push_child(Content::Elt(md.root_element().clone()));
}
@@ -222,13 +234,19 @@ impl Document {
assert!(level <= 6);
let mut number = Element::new(ElementTag::Span);
+ number.push_attribute(Attribute::new("class", "heading-number"));
number.push_child(Content::Text(numberer.number(level)));
+ let mut htext = Element::new(ElementTag::Span);
+ htext.push_attribute(Attribute::new("class", "heading-text"));
+ htext.push_child(Content::Text(text));
+
let mut a = Element::new(ElementTag::A);
a.push_attribute(crate::html::Attribute::new("href", &format!("#{}", id)));
+ a.push_attribute(Attribute::new("class", "toc-link"));
a.push_child(Content::Elt(number));
a.push_child(Content::Text(" ".into()));
- a.push_child(Content::Text(text));
+ a.push_child(Content::Elt(htext));
let mut li = Element::new(ElementTag::Li);
li.push_child(Content::Elt(a));
@@ -276,6 +294,7 @@ impl Document {
fn typeset_meta(&self) -> Element {
let mut div = Element::new(ElementTag::Div);
+ div.push_attribute(Attribute::new("class", "meta"));
div.push_child(Content::Elt(Self::title(self.meta.title())));
@@ -292,12 +311,14 @@ impl Document {
fn title(title: &str) -> Element {
let mut e = Element::new(ElementTag::H1);
+ e.push_attribute(Attribute::new("class", "title"));
e.push_child(Content::Text(title.into()));
e
}
fn authors(authors: &[String]) -> Element {
let mut list = Element::new(ElementTag::P);
+ list.push_attribute(Attribute::new("class", "authors"));
list.push_child(Content::Text("By: ".into()));
let mut first = true;
for a in authors {
@@ -312,6 +333,7 @@ impl Document {
fn date(date: &str) -> Element {
let mut e = Element::new(ElementTag::P);
+ e.push_attribute(Attribute::new("class", "date"));
e.push_child(Content::Text(date.into()));
e
}