aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-09-19 22:32:50 +0200
committermetamuffin <metamuffin@disroot.org>2025-09-19 22:40:39 +0200
commit42752bf88f962d8ed9210846a7c17798ae03d6f2 (patch)
tree8ae3c1b2e2b08a775a638222a697ed4b0e618bad
parent402067b8317195fd2bc4ab4d92b5ace94fadb7c0 (diff)
downloadhurrycurry-42752bf88f962d8ed9210846a7c17798ae03d6f2.tar
hurrycurry-42752bf88f962d8ed9210846a7c17798ae03d6f2.tar.bz2
hurrycurry-42752bf88f962d8ed9210846a7c17798ae03d6f2.tar.zst
start book html
-rw-r--r--server/tools/src/book.rs8
-rw-r--r--server/tools/src/book_html.rs24
-rw-r--r--server/tools/src/main.rs12
3 files changed, 40 insertions, 4 deletions
diff --git a/server/tools/src/book.rs b/server/tools/src/book.rs
index 6c871274..b77525af 100644
--- a/server/tools/src/book.rs
+++ b/server/tools/src/book.rs
@@ -23,7 +23,7 @@ use hurrycurry_protocol::{
book::{Book, BookPage},
};
-pub fn book() -> Result<()> {
+pub fn book() -> Result<Book> {
let mut diagram = recipe_diagram(&["plate:cheese-leek-soup".to_owned()])?;
diagram_layout(&mut diagram)?;
@@ -35,7 +35,11 @@ pub fn book() -> Result<()> {
diagram,
});
- let book = Book { pages };
+ Ok(Book { pages })
+}
+
+pub fn print_book() -> Result<()> {
+ let book = book()?;
println!("{}", serde_json::to_string_pretty(&book).unwrap());
Ok(())
}
diff --git a/server/tools/src/book_html.rs b/server/tools/src/book_html.rs
new file mode 100644
index 00000000..370f6901
--- /dev/null
+++ b/server/tools/src/book_html.rs
@@ -0,0 +1,24 @@
+/*
+ Hurry Curry! - a game about cooking
+ Copyright (C) 2025 Hurry Curry! Contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, version 3 of the License only.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+*/
+
+use anyhow::Result;
+use hurrycurry_protocol::book::Book;
+
+pub fn render_html_book(book: Book) -> Result<()> {
+ Ok(())
+}
diff --git a/server/tools/src/main.rs b/server/tools/src/main.rs
index bb8fbde2..31da0388 100644
--- a/server/tools/src/main.rs
+++ b/server/tools/src/main.rs
@@ -17,12 +17,18 @@
*/
pub mod book;
+pub mod book_html;
pub mod diagram_layout;
pub mod graph;
pub mod graph_summary;
pub mod recipe_diagram;
-use crate::{book::book, graph::graph, graph_summary::graph_summary};
+use crate::{
+ book::{book, print_book},
+ book_html::render_html_book,
+ graph::graph,
+ graph_summary::graph_summary,
+};
use anyhow::Result;
use clap::Parser;
@@ -31,6 +37,7 @@ enum Action {
Graph,
GraphSummary,
Book,
+ BookHtml,
}
fn main() -> Result<()> {
@@ -39,7 +46,8 @@ fn main() -> Result<()> {
match action {
Action::Graph => graph()?,
Action::GraphSummary => graph_summary()?,
- Action::Book => book()?,
+ Action::Book => print_book()?,
+ Action::BookHtml => render_html_book(book()?)?,
}
Ok(())