Skip to content

Commit

Permalink
remove rst support and add link property to events
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneberger committed Nov 3, 2024
1 parent 0eb3568 commit c1ba7a9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 267 deletions.
222 changes: 0 additions & 222 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ tracing = "0.1"
anyhow = "1.0"
regex = "1.10"
select = "0.6"
rst_parser = "0.4"
rst_renderer = "0.4"

asciidork-parser = "0.6.0"
asciidork-dr-html-backend = "0.6.0"

Expand Down
30 changes: 8 additions & 22 deletions src/blog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use std::sync::Arc;
use anyhow::anyhow;
use asciidork_parser::prelude::Bump;
use asciidork_parser::Parser;
use rst_parser::parse;
use rst_renderer::render_html;
use serde::de::Error;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use time::Date;
Expand Down Expand Up @@ -86,32 +84,20 @@ impl Blog {
continue;
}

let is_rst_file = file_name.ends_with(".rst");
let is_adoc_file = file_name.ends_with(".adoc");

info!("reading blog post: {} is rst: {}", &file_name, &is_rst_file);
info!(
"reading blog post: {} is adoc: {}",
&file_name, &is_adoc_file
);
let (idx, lang, slug) = parse_file_name(file_name).expect("cannot parse file name");

let body = if is_rst_file {
let mut buffer: Vec<u8> = Vec::new();
let parsed_rst = parse(text)
.map_err(|e| {
eprintln!("cannot parse rst file {} with error {}", &file_name, e);
})
.unwrap_or_default();
render_html(&parsed_rst, &mut buffer, true)
.map_err(|e| {
eprintln!(
"cannot render rst file to html {} with error {}",
&file_name, e
);
})
.unwrap_or_default();
String::from_utf8(buffer)?
} else if is_adoc_file {
let body = if is_adoc_file {
let bump = &Bump::with_capacity(text.len());

let x = Parser::new_settings(bump, text, Default::default()).parse().unwrap();
let x = Parser::new_settings(bump, text, Default::default())
.parse()
.unwrap();

asciidork_dr_html_backend::convert(x.document).unwrap()
} else {
Expand Down
Loading

0 comments on commit c1ba7a9

Please sign in to comment.