diff options
author | Lars Wirzenius <liw@liw.fi> | 2024-04-20 09:45:48 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2024-04-20 09:45:48 +0300 |
commit | be6eb22bb2336d6509a3030e079614b59da75cb8 (patch) | |
tree | b57a2c6cba81bd805a3f7071eda4ff2c852a600e | |
parent | 296dcf7ec3b45e085c41f4938dd8b1ad71e921b5 (diff) | |
download | html-page-be6eb22bb2336d6509a3030e079614b59da75cb8.tar.gz |
feat! rename Document to HtmlPage0.3.0
HtmlPage seems like a better name.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Sponsored-by: author
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/lib.rs | 12 |
3 files changed, 8 insertions, 8 deletions
@@ -13,7 +13,7 @@ dependencies = [ [[package]] name = "html-page" -version = "0.2.1" +version = "0.3.0" dependencies = [ "html-escape", ] @@ -1,6 +1,6 @@ [package] name = "html-page" -version = "0.2.1" +version = "0.3.0" edition = "2021" authors = [ "Lars Wirzenius <liw@liw.fi>", @@ -28,19 +28,19 @@ use std::fmt::{Display, Formatter}; /// An HTML document ("page'),consisting of a head and a body element. /// /// ~~~ -/// # use html_page::{Document, Element, Tag}; +/// # use html_page::{HtmlPage, Element, Tag}; /// let title = Element::new(Tag::Title).with_text("my page"); -/// let doc = Document::default().with_head_element(title); +/// let doc = HtmlPage::default().with_head_element(title); /// assert_eq!(format!("{}", doc), "<!DOCTYPE html>\n<HTML>\n\ /// <HEAD><TITLE>my page</TITLE></HEAD>\n<BODY/>\n</HTML>\n"); /// ~~~ #[derive(Clone, Debug, Eq, PartialEq)] -pub struct Document { +pub struct HtmlPage { head: Element, body: Element, } -impl Default for Document { +impl Default for HtmlPage { fn default() -> Self { Self { head: Element::new(Tag::Head), @@ -49,7 +49,7 @@ impl Default for Document { } } -impl Document { +impl HtmlPage { /// Append an element to the head. pub fn push_to_head(&mut self, e: Element) { self.head.push_child(e); @@ -86,7 +86,7 @@ impl Document { } } -impl Display for Document { +impl Display for HtmlPage { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { writeln!(f, "<!DOCTYPE html>")?; writeln!(f, "<{}>", Tag::Html)?; |