Skip to content

Commit

Permalink
Merge branch 'generate-Html-doc' of https://github.com/Phil-Ebsworth/…
Browse files Browse the repository at this point in the history
…polarity into generate-Html-doc
  • Loading branch information
Phil-Ebsworth committed Dec 4, 2024
2 parents bbb994b + a6f53b4 commit 7a1a664
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lang/docs/src/doc.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
use std::fs;
use std::io::prelude::*;
use std::path::{Path, PathBuf};
use std::path::{Path, PathBuf};

use askama::Template;
use askama::Template;
use opener;

use driver::paths::{CSS_PATH, CSS_TEMPLATE_PATH};
use driver::paths::{CSS_PATH, CSS_TEMPLATE_PATH};
use driver::Database;

use crate::generate_docs::GenerateDocs;

use crate::generate_docs::GenerateDocs;

pub async fn write_html(filepath: &PathBuf, htmlpath: &PathBuf) {
let mut db = Database::from_path(filepath);
let uri = db.resolve_path(filepath).expect("Failed to resolve path");
Expand Down Expand Up @@ -42,6 +47,16 @@ struct ModuleTemplate<'a> {
code: &'a str,
}

fn generate_html(title: &str, code: &str) -> String {
let template = ModuleTemplate { title, code };
template.render().unwrap()
#[derive(Template)]
#[template(path = "module.html", escape = "none")]
struct ModuleTemplate<'a> {
title: &'a str,
code: &'a str,
}

fn generate_html(title: &str, code: &str) -> String {
let template = ModuleTemplate { title, code };
template.render().unwrap()
Expand Down

0 comments on commit 7a1a664

Please sign in to comment.