finished rewrite. custon folders work now
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
use regex::Regex;
|
||||
use std::process;
|
||||
|
||||
use crate::app::config::config::Config;
|
||||
|
||||
fn exec_command(command: &mut process::Command) -> Result<(), String> {
|
||||
let result = command.output();
|
||||
|
||||
@@ -32,11 +34,14 @@ fn asciidoctor_docs(in_path: &str, out_path: &str) -> process::Command {
|
||||
return command;
|
||||
}
|
||||
|
||||
fn asciidoctor_slides(in_path: &str, out_path: &str, offline_reveal: bool) -> process::Command {
|
||||
fn asciidoctor_slides(in_path: &str, out_path: &str, config: &Config) -> process::Command {
|
||||
let mut command = process::Command::new(format!("asciidoctor-revealjs"));
|
||||
let out_dir = parent_path(out_path);
|
||||
let revealjs_path = if offline_reveal {
|
||||
path_between(out_dir.to_string(), "./dist/slides/revealjs".to_string())
|
||||
let revealjs_path = if config.offline_reveal {
|
||||
path_between(
|
||||
out_dir.to_string(),
|
||||
format!("{}/slides/revealjs", config.output_dir),
|
||||
)
|
||||
} else {
|
||||
"https://cdn.jsdelivr.net/npm/reveal.js@5.2.1".to_string()
|
||||
};
|
||||
@@ -104,13 +109,13 @@ pub fn matching_from_start(from_segments: &Vec<String>, to_segments: &Vec<String
|
||||
return from_segments.len();
|
||||
}
|
||||
|
||||
pub fn build_doc(in_path: &str, out_path: &str) -> Result<(), String> {
|
||||
pub fn build_doc(in_path: &str, out_path: &str, _: &Config) -> Result<(), String> {
|
||||
let mut command = asciidoctor_docs(in_path, out_path);
|
||||
return exec_command(&mut command);
|
||||
}
|
||||
|
||||
pub fn build_slide(in_path: &str, out_path: &str, offline_reveal: bool) -> Result<(), String> {
|
||||
let mut command = asciidoctor_slides(in_path, out_path, offline_reveal);
|
||||
pub fn build_slide(in_path: &str, out_path: &str, config: &Config) -> Result<(), String> {
|
||||
let mut command = asciidoctor_slides(in_path, out_path, config);
|
||||
return exec_command(&mut command);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user