ajout fonctionnalité choix dossier
This commit is contained in:
parent
da7feea04e
commit
2060f8044b
2 changed files with 22 additions and 5 deletions
13
README.md
13
README.md
|
|
@ -6,11 +6,9 @@ clone this repo
|
||||||
|
|
||||||
``` chmod +x genlog.sh ```
|
``` chmod +x genlog.sh ```
|
||||||
|
|
||||||
put your files in the "content" folder
|
|
||||||
|
|
||||||
your .gmi files are converted in html and concatenated with the html/header.html and the html/footer.html
|
your .gmi files are converted in html and concatenated with the html/header.html and the html/footer.html
|
||||||
the .html file is witen in the directory of the .gmi file which has been treated
|
the .html file is witen in the directory of the .gmi file which has been treated
|
||||||
this script will recursively search all .gmi files contained in the "content" folder, even in the other folders it includes
|
this script will recursively search all .gmi files contained in the "content" folder or a path given as an argument to the script, even in the other folders it includes
|
||||||
|
|
||||||
feel free to customize the html/header.html and the html/footer.html as you like
|
feel free to customize the html/header.html and the html/footer.html as you like
|
||||||
|
|
||||||
|
|
@ -23,3 +21,12 @@ please keep the
|
||||||
```
|
```
|
||||||
|
|
||||||
in the html/header.html file if you want your generated pages to have a properly defined title in the HTML
|
in the html/header.html file if you want your generated pages to have a properly defined title in the HTML
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
put your files in the "content" folder
|
||||||
|
``` ./genlog.sh ```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
``` ./genlog.sh /path/to/your/choosen/folder ```
|
||||||
|
|
|
||||||
14
genlog.sh
14
genlog.sh
|
|
@ -3,8 +3,18 @@
|
||||||
# on créé un répertoire de taff temporaire pour foutre nos fichiers en cours de traitement dedans
|
# on créé un répertoire de taff temporaire pour foutre nos fichiers en cours de traitement dedans
|
||||||
tempdir="$(mktemp -d)"
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
# on cherche récursivement tous les fichiers ".gmi" dans le dossier "content"
|
# on vérifie s'il y a un argument passé à notre script
|
||||||
find "${PWD}"/content -wholename "*.gmi" -type f | while read -r gmi_file
|
if "$1"
|
||||||
|
then
|
||||||
|
# si oui, on l'utilise comme path ou aller taffer
|
||||||
|
source_path="$1"
|
||||||
|
else
|
||||||
|
# sinon on utilise le dossier "content"
|
||||||
|
source_path="${PWD}"/content
|
||||||
|
fi
|
||||||
|
|
||||||
|
# on cherche récursivement tous les fichiers ".gmi" dans le dossier de taff
|
||||||
|
find "$source_path" -wholename "*.gmi" -type f | while read -r gmi_file
|
||||||
do
|
do
|
||||||
|
|
||||||
# récupérer la 1ère ligne du fichier .gmi et remplacer "# " par ""
|
# récupérer la 1ère ligne du fichier .gmi et remplacer "# " par ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue