5 Commits
Author SHA1 Message Date
aitzol 0b623a6e0d v0.1.3 2025-08-16 17:30:25 +02:00
aitzol 03466aad80 v0.1.3 2025-08-16 17:21:22 +02:00
aitzol 9209299af6 v0.1.3 2025-08-16 17:20:25 +02:00
aitzol 1a7b0352eb README 2024-06-11 21:52:24 +02:00
aitzol 19f8fd61b9 README 2024-06-11 21:35:06 +02:00
7 changed files with 34 additions and 10 deletions
+4
View File
@@ -11,3 +11,7 @@
## v0.1.2 ## v0.1.2
* Including the resource directory to the executable binary. * Including the resource directory to the executable binary.
## v0.1.3
* Assign the working directory name to the document(project) if the user does not enter one.
* Minor bug fixes.
Generated
+1 -1
View File
@@ -105,7 +105,7 @@ dependencies = [
[[package]] [[package]]
name = "dokugile" name = "dokugile"
version = "0.1.2" version = "0.1.3"
dependencies = [ dependencies = [
"colorize", "colorize",
"dirs", "dirs",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "dokugile" name = "dokugile"
version = "0.1.2" version = "0.1.3"
edition = "2021" edition = "2021"
author = "Aitzol Berasategi" author = "Aitzol Berasategi"
repository = "https://git.lainoa.eus/aitzol/dokugile.git" repository = "https://git.lainoa.eus/aitzol/dokugile.git"
+3 -1
View File
@@ -6,10 +6,12 @@ Simple document generator from Markdown to Html.
# how to use # how to use
These steps are indicated for _Debian_ based distros. These steps are indicated for _Debian_ based distros.
* _Pandoc_ is required. To install it run
* _Pandoc_ version 3.1.13 or higher is required. You can try to install it from the repositories by running the following command, but you will probably find newer versions here: https://github.com/jgm/pandoc/releases
```bash ```bash
sudo apt-get install pandoc sudo apt-get install pandoc
``` ```
* Download and execute _dokugile_ binary * Download and execute _dokugile_ binary
```bash ```bash
sudo chmod +x dokugile sudo chmod +x dokugile
+3 -1
View File
@@ -2,12 +2,14 @@ _version: 1
Project name: 'Project name' Project name: 'Project name'
Project location: 'Project location' Project location: 'Project location'
Do you want to create a new location called %{s} for the documents?(y/n)[Y]: 'Do you want to create a new location called %{s} for the documents?(y/n)[Y]' Do you want to create a new location called %{s} for the documents?(y/n)[Y]: 'Do you want to create a new location called %{s} for the documents?(y/n)[Y]'
You must assign a name to your project. Would you like to call it %{s}?(y/n)[Y]: 'You must assign a name to your project. Would you like to call it %{s}?(y/n)[Y]'
Okay, so your project is called %{s}: 'Okay, so your project is called %{s}'
Location %{s} has been created: 'Location %{s} has been created' Location %{s} has been created: 'Location %{s} has been created'
The project %{s} has not been found. Do you want to create it?(y/n)[Y]: 'The project %{s} has not been found. Do you want to create it?(y/n)[Y]' The project %{s} has not been found. Do you want to create it?(y/n)[Y]: 'The project %{s} has not been found. Do you want to create it?(y/n)[Y]'
Project %{s} has been created. Now you can edit index.md file and create content: 'Project %{s} has been created. Now you can edit index.md file and create content' Project %{s} has been created. Now you can edit index.md file and create content: 'Project %{s} has been created. Now you can edit index.md file and create content'
found... %{s}: 'found... %{s}' found... %{s}: 'found... %{s}'
No markdown files found!: 'No markdown files found!' No markdown files found!: 'No markdown files found!'
Pleade edit first your documents in markdown format and come back to convert them to html. Bye!: 'Please edit first your documents in markdown format and come back to convert them to html. Bye!' Please edit first your documents in markdown format and come back to convert them to html. Bye!: 'Please edit first your documents in markdown format and come back to convert them to html. Bye!'
Processed markdown files.. %{s}: 'Processed markdown files.. %{s}' Processed markdown files.. %{s}: 'Processed markdown files.. %{s}'
Congrats! Check your documentation at.. %{s}: 'Congrats! Check your documentation at.. %{s}' Congrats! Check your documentation at.. %{s}: 'Congrats! Check your documentation at.. %{s}'
Please consider renaming your main page to index.md and restart the document conversion again. See you later!: 'Please consider renaming your main page to index.md and restart the document conversion again. See you later!' Please consider renaming your main page to index.md and restart the document conversion again. See you later!: 'Please consider renaming your main page to index.md and restart the document conversion again. See you later!'
+2
View File
@@ -2,6 +2,8 @@ _version: 1
Project name: 'Proiektuaren izena' Project name: 'Proiektuaren izena'
Project location: 'Proiektuaren kokapena' Project location: 'Proiektuaren kokapena'
Do you want to create a new location called %{s} for the documents?(y/n)[Y]: 'Dokumentuentzako %{s} izeneko kokapen berria sortu nahi duzu?(b/e)[B]' Do you want to create a new location called %{s} for the documents?(y/n)[Y]: 'Dokumentuentzako %{s} izeneko kokapen berria sortu nahi duzu?(b/e)[B]'
You must assign a name to your project. Would you like to call it %{s}?(y/n)[Y]: 'Izena jarri behar diozu zure proiektuari. %{s} deitzea nahiko zenuke?(b/e)[B]'
Okay, so your project is called %{s}: 'Ederki, zure proiektua %{s} deitzen da'
Location %{s} has been created: '%{s} kokapena sortu da' Location %{s} has been created: '%{s} kokapena sortu da'
The project %{s} has not been found. Do you want to create it?(y/n)[Y]: '%{s} proiektua ez da aurkitu. Sortu egin nahi duzu?(b/e)[B]' The project %{s} has not been found. Do you want to create it?(y/n)[Y]: '%{s} proiektua ez da aurkitu. Sortu egin nahi duzu?(b/e)[B]'
Project %{s} has been created. Now you can edit index.md file and create content: '%{s} proiektua sortu da. Orain index.md fitxategia editatu eta edukiak sor ditzakezu' Project %{s} has been created. Now you can edit index.md file and create content: '%{s} proiektua sortu da. Orain index.md fitxategia editatu eta edukiak sor ditzakezu'
+20 -6
View File
@@ -68,7 +68,7 @@ fn main() {
io::stdin().read_line(&mut ans).expect("Failed to read line"); io::stdin().read_line(&mut ans).expect("Failed to read line");
if ans.trim().is_empty() { ans = String::from("Y") }; if ans.trim().is_empty() { ans = String::from("Y") };
match ans.trim() { match ans.trim() {
"y" | "yes" | "Y" | "B" | "Bai" => { //let _ = fs::create_dir(&wiki_path); "y" | "yes" | "Y" | "b" | "B" | "Bai" => { //let _ = fs::create_dir(&wiki_path);
let _ = mkdir(&wiki_path); let _ = mkdir(&wiki_path);
println!("{}.", t!("Location %{s} has been created", s = &project_dir.trim().to_owned().green().bold())); println!("{}.", t!("Location %{s} has been created", s = &project_dir.trim().to_owned().green().bold()));
}, },
@@ -81,7 +81,21 @@ fn main() {
attempts += 1; attempts += 1;
} }
if attempts == 3 { if attempts == 3 {
break //break
let cwd = env::current_dir().unwrap().display().to_string();
let dirs: Vec<&str> = cwd.split('/').collect();
if input.trim().is_empty() { input = capitalize_first_letter( dirs.last().unwrap() ) };
let mut ans = String::new();
println!("{}", t!("You must assign a name to your project. Would you like to call it %{s}?(y/n)[Y]", s = input.clone().green()));
io::stdin().read_line(&mut ans).expect("Failed to read line");
if ans.trim().is_empty() { ans = String::from("Y") };
match ans.trim() {
"y" | "yes" | "Y" | "b" | "B" | "Bai" => {
println!("{}.\n", t!("Okay, so your project is called %{s}", s = &input.trim().to_owned().green().bold()));
},
_ => std::process::abort(),
};
}; };
doc_title = input.to_string(); doc_title = input.to_string();
@@ -132,7 +146,7 @@ fn main() {
}; };
} }
} }
println!("{}.", t!("Project %{s} has been created. Now you can edit index.md file and create content", s = &input.trim().to_owned().green().bold())); println!("{}.\n", t!("Project %{s} has been created. Now you can edit index.md file and create content", s = &input.trim().to_owned().green().bold()));
//remove temporary created assets directory //remove temporary created assets directory
let _ = fs::remove_dir_all(Path::new("/tmp/assets")); let _ = fs::remove_dir_all(Path::new("/tmp/assets"));
}, },
@@ -167,11 +181,11 @@ fn copy(source: &String, dest: &String) -> std::io::Result<()> {
fs::copy(source, dest)?; fs::copy(source, dest)?;
Ok(()) Ok(())
} }
/*
fn capitalize_first_letter(s: &str) -> String { fn capitalize_first_letter(s: &str) -> String {
s[0..1].to_uppercase() + &s[1..] s[0..1].to_uppercase() + &s[1..]
} }
*/
fn processing(project: Project) -> Result<String, String>{ fn processing(project: Project) -> Result<String, String>{
let mut md_count :i32 = 0; let mut md_count :i32 = 0;
@@ -215,7 +229,7 @@ fn processing(project: Project) -> Result<String, String>{
if error.is_empty() { if error.is_empty() {
if md_count == 0 { if md_count == 0 {
println!("{}", t!("No markdown files found!")); println!("{}", t!("No markdown files found!"));
println!("{}", t!("Pleade edit first your documents in markdown format and come back to convert them to html. Bye!")); println!("{}", t!("Please edit first your documents in markdown format and come back to convert them to html. Bye!"));
}else{ }else{
println!("{}", t!("Processed markdown files.. %{s}", s = md_count)); println!("{}", t!("Processed markdown files.. %{s}", s = md_count));
} }