aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-06-08 10:05:30 +0100
committerSilvio Rhatto <rhatto@riseup.net>2024-06-08 10:05:30 +0100
commit46087a2503032443d7f0613e5aeb2a5195c27850 (patch)
tree910ebd4bdc62360ed53881671a471d5ef2e2ca44
parentbff0778cb9751a0581ab0eb2ca97cbdca8bcca03 (diff)
downloadbookup-46087a2503032443d7f0613e5aeb2a5195c27850.tar.gz
bookup-46087a2503032443d7f0613e5aeb2a5195c27850.tar.bz2
Fix: misc improvements
-rw-r--r--.gitignore4
-rw-r--r--Makefile.bookup32
-rw-r--r--TODO.md5
-rwxr-xr-xbin/archive11
-rwxr-xr-xbin/assemble19
-rwxr-xr-xbin/provision-host8
-rw-r--r--content/sections/00-intro/intro.md (renamed from content/published/00-intro/intro.md)0
-rw-r--r--content/sections/05-workflow/funcionamento.md (renamed from content/published/05-workflow/funcionamento.md)0
-rw-r--r--content/sections/10-structure/structure.md (renamed from content/published/10-structure/structure.md)4
-rw-r--r--content/sections/15-installation/installation.md (renamed from content/published/15-installation/installation.md)0
-rw-r--r--structure/99-end.tex8
11 files changed, 50 insertions, 41 deletions
diff --git a/.gitignore b/.gitignore
index 6b6d3ea..28ecae4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,8 @@
# Assets
archive/*
backups/*
-compiled/*
-public/*
+book/*
+build/*
slides/*.pdf
_main_files
diff --git a/Makefile.bookup b/Makefile.bookup
index 7eb93e8..327558a 100644
--- a/Makefile.bookup
+++ b/Makefile.bookup
@@ -17,6 +17,9 @@ PROJECT ?= bookup
# Output file names (prefix)
OUTPUT ?= book
+# Output folder
+OUTPUT_FOLDER ?= $(OUTPUT)
+
# Destination website hostname (for rsync+ssh)
WEBSITE ?= $(PROJECT)
@@ -101,8 +104,9 @@ compile_book: metadata
@/bin/bash -c 'cat _biblio.yml >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md'
@/bin/bash -c 'for file in $(BOOKUP)/structure/00*.yml; do cat $$file >> $(OUTPUT).md ; echo "---" >> $(OUTPUT).md; done'
@/bin/bash -c 'for file in $(BOOKUP)/structure/00*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
- @/bin/bash -c 'for file in content/published/*/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
- @/bin/bash -c 'for file in content/published/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
+ @#/bin/bash -c 'for file in content/sections/*/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
+ @#/bin/bash -c 'for file in content/sections/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
+ @/bin/bash -c 'find content/sections -type f | sort | while read file; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
@/bin/bash -c 'for file in $(BOOKUP)/structure/99*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
@sed -i -e "s|%%revision%%|$(REVISION)|g" -e "s|%%date%%|$(DATE)|g" $(OUTPUT).md
@test -e snippets/terminology.sed && sed -i -f snippets/terminology.sed $(OUTPUT).md || true
@@ -131,7 +135,7 @@ bookdown_html:
# Cleanup
@#rm -rf $(OUTPUT)/html $(OUTPUT)/$(OUTPUT).html
- @rm -rf compiled
+ @rm -rf $(OUTPUT_FOLDER)
# Fix references
# Use sed to fix a weird reference issue on fig.cap inside knitr blocks that are not properly converted.
@@ -151,23 +155,23 @@ bookdown_html:
#@cd _book && ln -s "início.html" index.html
@#mv _book $(OUTPUT)/html
@#mv index.html.old index.html
- @mv _book compiled
+ @mv _book $(OUTPUT_FOLDER)
# Replace fuse.js from CDN to local
# This ensures the HTML output can be browsed offline
#@find $(OUTPUT)/html -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|../../vendor/Fuse.js/dist/fuse.min.js|' {} \;
- @mkdir compiled/js
- @cp vendor/bookup/vendor/Fuse.js/dist/fuse.min.js compiled/js
- @find compiled -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|js/fuse.min.js|' {} \;
+ @mkdir $(OUTPUT_FOLDER)/js
+ @cp vendor/bookup/vendor/Fuse.js/dist/fuse.min.js $(OUTPUT_FOLDER)/js
+ @find $(OUTPUT_FOLDER) -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|js/fuse.min.js|' {} \;
# Add revision information
- @echo $(REVISION) > compiled/revision
+ @echo $(REVISION) > $(OUTPUT_FOLDER)/revision
# Add symlink to the archive and to the slides
# This symlink is useful for checking things in localhost
# But it tends to be replaced during remote deployment
- @cd compiled > /dev/null && ln -s ../archive
- @cd compiled > /dev/null && ln -s ../slides
+ @cd $(OUTPUT_FOLDER) > /dev/null && ln -s ../archive
+ @cd $(OUTPUT_FOLDER) > /dev/null && ln -s ../slides
bookdown_pdf:
# Cleanup old builds
@@ -179,7 +183,7 @@ bookdown_pdf:
# Move
@#mv _main.pdf $(OUTPUT).pdf
@#mv _book/_main.pdf $(OUTPUT)/$(OUTPUT).pdf
- @mv _book/_main.pdf compiled/$(OUTPUT).pdf
+ @mv _book/_main.pdf $(OUTPUT_FOLDER)/$(OUTPUT).pdf
# Use sed to convert tufte::margin_note to marginfigure
# Also, "sed -i" yields a permission denied error when running inside a guest VM.
@@ -195,7 +199,7 @@ bookdown_epub:
# Move
@##mv _book/_main.epub $(OUTPUT)/$(OUTPUT).epub
- @#mv _book/_main.epub compiled/$(OUTPUT)s.epub
+ @#mv _book/_main.epub $(OUTPUT_FOLDER)/$(OUTPUT)s.epub
# Cleanup
@#rm _book/reference-keys.txt
@@ -208,7 +212,7 @@ bookdown: bookdown_clean bookdown_html bookdown_pdf bookdown_epub
#
move_book:
- @mv $(OUTPUT).* compiled/
+ @mv $(OUTPUT).* $(OUTPUT_FOLDER)/
assemble:
@$(BOOKUP)/bin/assemble
@@ -260,7 +264,7 @@ site:
#
web_deploy:
- @rsync -avz --delete $(EXCLUDES) ./public/ $(WEBSITE):/
+ @rsync -avz --delete $(EXCLUDES) ./build/ $(WEBSITE):/
@rsync -avz --delete ./archive/ $(WEBSITE):/archive/
@rsync -avz --delete ./slides/ $(WEBSITE):/slides/
diff --git a/TODO.md b/TODO.md
index 9aedc76..1bb46f5 100644
--- a/TODO.md
+++ b/TODO.md
@@ -2,8 +2,10 @@
## Basic
+* [x] Use `book` instead of `compiled`.
+* [x] Use `content/sections` instead of `content/published`.
+* [ ] Use `build` instead of `public`.
* [ ] Move `slides` to `content/slides`.
-* [ ] Use `content/sections` instead of `content/published`.
* [ ] Add other features available in the `cybersni` repository.
* [ ] Add a small reference to the Bookup website in the book frontmatter?
* [ ] Improve the documentation, including:
@@ -20,6 +22,7 @@
## Issues
+* [ ] List of definitions and etimologies breaks build if they're empty.
* [ ] Bug no `pandoc` ou `citeproc` ignorando citações dentro de blocos LaTeX.
Afetando o formato PDF. Vide projeto `test`, em `~/code/test/pandoc`.
Considerar um relatório upstream.
diff --git a/bin/archive b/bin/archive
index 584ea13..8949268 100755
--- a/bin/archive
+++ b/bin/archive
@@ -9,14 +9,15 @@ DIRNAME="`dirname $0`"
BASEDIR="$DIRNAME/.."
#ARCHIVE="$BASEDIR/archive"
ARCHIVE="archive"
+ASSETS="build"
REVISION="`git describe --tags 2> /dev/null || git log -1 --format=oneline | cut -d ' ' -f 1`"
# Determine the revision file
-if [ -e "public/revision" ]; then
- #REVFILE="$BASEDIR/public/revision"
- REVFILE="public/revision"
+if [ -e "$ASSETS/revision" ]; then
+ #REVFILE="$BASEDIR/$ASSETS/revision"
+ REVFILE="$ASSETS/revision"
else
- REVFILE="public/book/revision"
+ REVFILE="$ASSETS/book/revision"
fi
# Make sure the archive folder exist
@@ -41,7 +42,7 @@ if git tag | grep -q "^${OLD_REVISION}"; then
# Check if archive does not exists
if [ ! -d "$ARCHIVE/$OLD_REVISION" ]; then
echo "# $BASENAME: archiving $OLD_REVISION..."
- cp -alf compiled $ARCHIVE/$OLD_REVISION
+ cp -alf $ASSETS $ARCHIVE/$OLD_REVISION
else
echo "# $BASENAME: revision $OLD_REVISION already archived"
fi
diff --git a/bin/assemble b/bin/assemble
index cd0836c..3b5b287 100755
--- a/bin/assemble
+++ b/bin/assemble
@@ -8,26 +8,27 @@ BASENAME="`basename $0 | sed -e 's/\(.\)/\U\1/'`"
DIRNAME="`dirname $0`"
BASEDIR="$DIRNAME/.."
SITE="site"
+BOOK="book"
NOTEBOOK="notebook"
-PUBLIC="public"
+BUILD="build"
-# Cleanup the previous public folder
-rm -rf $PUBLIC
+# Cleanup the previous build folder
+rm -rf $BUILD
# Check if there's a site folder
if [ -e "$SITE" ]; then
- cp -a $SITE public
+ cp -a $SITE $BUILD
- if [ -e "compiled" ]; then
- mv compiled public/book
+ if [ -e "$BOOK" ]; then
+ mv $BOOK $BUILD/book
fi
else
- if [ -e "compiled" ]; then
- mv compiled public
+ if [ -e "$BOOK" ]; then
+ mv $BOOK $BUILD
fi
fi
# Check if there's a notebook
if [ -e "$NOTEBOOK" ]; then
- mv $NOTEBOOK public/notes
+ mv $NOTEBOOK $BUILD/notes
fi
diff --git a/bin/provision-host b/bin/provision-host
index 13b8a78..81cf602 100755
--- a/bin/provision-host
+++ b/bin/provision-host
@@ -44,9 +44,9 @@ cat <<-EOF | $SUDO tee /etc/apache2/sites-available/onion.conf > /dev/null
<VirtualHost 127.0.0.1:80>
ServerName localhost
ServerAlias *.onion
- DocumentRoot "/srv/shared/public"
+ DocumentRoot "/srv/shared/build"
- <Directory /srv/shared/public>
+ <Directory /srv/shared/build>
#AuthType Basic
#AuthName "Protected"
#AuthUserFile /srv/shared/.htpasswd
@@ -62,9 +62,9 @@ EOF
cat <<-EOF | $SUDO tee /etc/apache2/sites-available/local.conf > /dev/null
<VirtualHost *:80>
ServerName ${PROJECT}.local
- DocumentRoot "/srv/shared/public"
+ DocumentRoot "/srv/shared/build"
- <Directory /srv/shared/public>
+ <Directory /srv/shared/build>
#AuthType Basic
#AuthName "Protected"
#AuthUserFile /srv/shared/.htpasswd
diff --git a/content/published/00-intro/intro.md b/content/sections/00-intro/intro.md
index 5e5c7d0..5e5c7d0 100644
--- a/content/published/00-intro/intro.md
+++ b/content/sections/00-intro/intro.md
diff --git a/content/published/05-workflow/funcionamento.md b/content/sections/05-workflow/funcionamento.md
index 66ff216..66ff216 100644
--- a/content/published/05-workflow/funcionamento.md
+++ b/content/sections/05-workflow/funcionamento.md
diff --git a/content/published/10-structure/structure.md b/content/sections/10-structure/structure.md
index cb1fafb..98b2f91 100644
--- a/content/published/10-structure/structure.md
+++ b/content/sections/10-structure/structure.md
@@ -5,12 +5,12 @@ A estrutura de pastas de um projeto usando Bookup é a seguinte:
* `archive`: armazena versões antigas do livro.
* `content`: o conteúdo do livro.
* `drafts`: deixe aqui os textos que ainda estão em composição.
- * `published`: aqui vai todo o material a ser compilado em livro.
+ * `sections`: aqui vai todo o material a ser compilado em livro.
* `notes`: caderno de anotações a ser incluído no material público.
* `slides`: slides no formato Markdown.
* `site`: HTML opcional usado para o sítio base; se existir, o livro será
colocado dentro da pasta `public/book` ou algo assim.
-* `public`: o livro compilado (HTML, PDF e outros formatos):
+* `build`: o livro compilado (HTML, PDF e outros formatos):
* `notes`: caderno de notas compilado.
* `book`: o livro compilado, se houver uma pasta `site`, caso contrário o
conteúdo dolivro será colocado na pasta raíz do diretório `public`.
diff --git a/content/published/15-installation/installation.md b/content/sections/15-installation/installation.md
index 9024b41..9024b41 100644
--- a/content/published/15-installation/installation.md
+++ b/content/sections/15-installation/installation.md
diff --git a/structure/99-end.tex b/structure/99-end.tex
index b50d1b7..f1657bd 100644
--- a/structure/99-end.tex
+++ b/structure/99-end.tex
@@ -16,14 +16,14 @@ Listas de tabelas, figuras etc.
% Print the list of definitions
% See https://latex.org/forum/viewtopic.php?t=17679
% https://ctan.org/pkg/thmtools
-\renewcommand\listtheoremname{Lista de Definições}
-\listoftheorems[ignoreall,show={definition}]
+%\renewcommand\listtheoremname{Lista de Definições}
+%\listoftheorems[ignoreall,show={definition}]
% Print the list of etimologies
% The "proposition" theorem type is allocated for etimologies in this book
% See the _bookdown.yml at the top-level project folder for more information
-\renewcommand\listtheoremname{Lista de Etimologias}
-\listoftheorems[ignoreall,show={proposition}]
+%\renewcommand\listtheoremname{Lista de Etimologias}
+%\listoftheorems[ignoreall,show={proposition}]
% Print the index
\printindex