From 854ea1977f4d5fe68c72d48dd64fa4b60a6a2734 Mon Sep 17 00:00:00 2001 From: quirinecker Date: Mon, 30 Jan 2023 18:34:45 +0100 Subject: [PATCH] added a shellscript for a workaround. executable not working --- sh/asciidoctor-revealjs-sh | 1 + src/app/builder/asciidoctor.rs | 14 +++++++------- src/app/commands/executions/build_execution.rs | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100755 sh/asciidoctor-revealjs-sh diff --git a/sh/asciidoctor-revealjs-sh b/sh/asciidoctor-revealjs-sh new file mode 100755 index 0000000..eb87d1d --- /dev/null +++ b/sh/asciidoctor-revealjs-sh @@ -0,0 +1 @@ +asciidoctor-revealjs $1 -a revealjsdir=$2 --out-file=$3 diff --git a/src/app/builder/asciidoctor.rs b/src/app/builder/asciidoctor.rs index 1bf80e0..44053b7 100644 --- a/src/app/builder/asciidoctor.rs +++ b/src/app/builder/asciidoctor.rs @@ -1,4 +1,4 @@ -use std::{process, fmt::format}; +use std::process; use regex::Regex; @@ -23,20 +23,21 @@ fn asciidoctor_docs(in_path: &str, out_path: &str) -> process::Command { let mut command = process::Command::new(format!("asciidoctor")); command - .arg(format!("{in_path}")) - .arg(format!("--out-file={out_path}")); + .arg(format!("--out-file={out_path}")) + .arg(format!("{in_path}")); return command; } fn asciidoctor_slides(in_path: &str, out_path: &str) -> process::Command { - let mut command = process::Command::new(format!("asciidoctor-revealjs")); + let mut command = process::Command::new(format!("sh")); let revealjs_path = path_between(out_path.to_string(), "./dist/slides/revealjs".to_string()); command + .arg("asciidoctor-revealjs-sh") .arg(format!("{in_path}")) - .arg(format!("-a revealjsdir={revealjs_path}")) - .arg(format!("--out-file={out_path}")); + .arg(format!("{revealjs_path}")) + .arg(format!("{out_path}")); return command; } @@ -47,7 +48,6 @@ pub fn path_between(from: String, to: String) -> String { let last_matching_index = matching_from_start(&from_segments, &to_segments); let number_of_backs = from_segments.len() - last_matching_index; let mut path_between = path_back(number_of_backs); - dbg!(&path_between); let path_to_to_path = &to_segments[last_matching_index..]; path_between.push_str(&path_to_to_path.join("/")); return path_between; diff --git a/src/app/commands/executions/build_execution.rs b/src/app/commands/executions/build_execution.rs index 0b428b2..110708a 100644 --- a/src/app/commands/executions/build_execution.rs +++ b/src/app/commands/executions/build_execution.rs @@ -1,4 +1,4 @@ -use std::{fs::{self, File}, path::{Path, PathBuf}, io::{Write, Cursor}}; +use std::{fs, path::{Path, PathBuf}, io::Cursor}; use crate::app::{ builder::{