diff options
33 files changed, 955 insertions, 227 deletions
diff --git a/ChangeLog.md b/ChangeLog.md index b72c275..5752d12 100644..120000 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,180 +1 @@ -# ChangeLog - -## v0.2.4 - 2024-10-06 - -* [x] Apply the previous `NULL` fix to the portuguese template. - -## v0.2.3 - 2024-10-06 - -* [x] Fix a `NULL` at the end of TOC in the PDF version. - It was inserted at the TeX source, due to an empty `R` block. -* [x] Removes the unused `biblio-style` config. - -## v0.2.2 - 2024-09-29 - -* [x] Display label before the book URL. - -* [x] Fix publisher metadata information on the PDF output. - This required changing changing the "publisher" - metadata from `_common.yml` to `snippets/publisher.txt`. - -## v0.2.1 - 2024-09-16 - -* [x] Fix TOC spacing between section numbers and section titles when there are - many sections making the section number too big. - -## v0.2.0 - 2024-08-16 - -* [x] Provision: ensure a recent ggplot2 is used. - -## v0.1.9 - 2024-07-13 - -* [x] Fix link to the Bookup site in the documentation. - -## v0.1.8 - 2024-07-13 - -* [x] Template translation fix. -* [x] Put list of etimologies before the list of definitions, - as they may usually come first (at least historically). - -## v0.1.7 - 2024-06-29 - -* [x] Do not include the references block at the end of every file processed. - -## v0.1.6 - 2024-06-19 - -* [x] Apply fixes to the archive/permalink logic. - -## v0.1.5 - 2024-06-19 - -* [x] Archive after doing a build, making sure that the current tag is already - in the archive (and hence can have a permalink upfront). - -## v0.1.4 - 2024-06-11 - -### Fixes - -* [x] Make sure the archive folder has some basic - links. - -### Features - -* [x] Fine-grained control of lists of tables, - figures etc. -* [x] Scaffolding to support a "Recent changes" - section in the compiled book. -* [x] Documentation: Bookup features, and minor - fixes. - -### Misc - -* [~] Move `slides` to `content/slides`? - -## v0.1.3 - 2024-06-10 - -### Fixes - -* [x] Fix bibliography handling. - -## v0.1.2 - 2024-06-10 - -### Features - -* [x] Improved BibTeX bibliography handling. - -## v0.1.1 - 2024-06-10 - -### Fixes - -* [x] GitLab pages. - -## v0.1.0 - 2024-06-10 - -### Fixes - -* [x] Cover page dimensions. - -## v0.0.9 - 2024-06-10 - -### Fixes - -* [x] GitLab pages. - -## v0.0.8 - 2024-06-10 - -### Features - -* [x] Localization support: - * [x] Detect the `lang` YAML parameters and use templates from - `{templates,structure}/{book,notes}/$lang`. - * [x] Compile the `_output.yml` from a template, setting the `includes` - from the appropriate language-based structure files. - * [x] Translate documentation to English. - -## v0.0.7 - 2024-06-09 - -### Features - -* [x] GitLab CI. - -## v0.0.6 - 2024-06-09 - -### Features - -* [x] Notebook: - * [x] Add link to the notebook in the main book HTML. - * [x] Add license and version information in the notebook. -* [x] Add the repository URL into the - documentation. -* [x] Improvements towards localization. - -### Issues - -* [x] Add a `test` folder for quick experiments. - -## v0.0.5 - 2024-06-09 - -### Features - -* [x] Improved compilation procedures. -* [x] Unified configuration for book and notes. - -## v0.0.4 - 2024-06-08 - -### Fixes - -* [x] Use `book` instead of `compiled`. -* [x] Use `build` instead of `public`. -* [x] Use `content/sections` instead of `content/published`. -* [x] List of definitions and etimologies breaks build if they're empty - (`99-end.tex`). - -### Misc - -* [~] Tests for quickly trying things? No need, simply try on this repository - directly. - -## v0.0.3 - 2024-06-08 - -### Features - -* [x] Notebook support. -* [x] Website support. - -## v0.0.2 - 2024-06-06 - -### Features - -* [x] Improved documentation. - -## v0.0.1 - 2024-06-06 - -### Features - -* [x] Package a Bookdown-based publishing solution in a project named `bookup` - ("a bookdown-based publishing solution") - or similar, to ease book editing and authorship. -* [x] Use the repository [ensaios][] as base. -* [x] Create a basic documentation. - -[ensaios]: https://ensaios.fluxo.info +content/notes/00-changelog/changelog.md
\ No newline at end of file @@ -0,0 +1 @@ +This is both a book template and a documentation in how to use it! diff --git a/Makefile.bookup b/Makefile.bookup index 079b93d..e358db2 100644 --- a/Makefile.bookup +++ b/Makefile.bookup @@ -93,6 +93,7 @@ metadata: @echo $(REVISION) > .metadata/revision.txt @echo $(DATE) > .metadata/date.txt @echo $(YEAR) > .metadata/year.txt + @test ! -e .metadata/latest.txt && echo '0.0.0' > .metadata/latest.txt || true # # Compilation @@ -227,7 +228,18 @@ bookdown_notes_html: # Replace fuse.js from CDN to local # This ensures the HTML output can be browsed offline - @find notebook -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|../js/fuse.min.js|' {} \; + # + # We could simply assume that there's a ../js/fuse.min.js, but that may not + # be always the case. + # + # Instead, we ship it's own js/ folder, making notes self-contained. + # + # Another approach would be to have a common, parent js/ folder for both the + # book and the notes, to minimize loading external resources. + @#find notebook -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|../js/fuse.min.js|' {} \; + @mkdir notebook/js + @cp vendor/bookup/vendor/Fuse.js/dist/fuse.min.js notebook/js + @find notebook -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|js/fuse.min.js|' {} \; notes: compile_notes bookdown_clean bookdown_notes_html move_notes clean @@ -16,6 +16,7 @@ ## Refactor +* [ ] Consider merging `ChangeLog.md` with `_changelog.yml`. * [ ] Create a `bookup` script: * [ ] Able to read all the YAML config files, which should be the central places to hold all the configuration. @@ -32,17 +33,11 @@ * [ ] Slides: * [ ] Improved slides workflow (compilation etc). * [ ] Citation: - * [ ] How to cite, by using `@projectName` in the frontmatter. * [ ] Add the corresponding BibTeX entry. -* [ ] Recent changes: - * [ ] Build the recent changes section through a `snippets/changes.md` file? - This is partially implemented, but commented. - As an alternative (or meanwhile), the notebook can be used. - * [ ] Alternativelly, build the recent changes using a `snippets/changes.yml` - or just `_changes.yml` that gets compilet into a `snippets/changes.md` - and into a RSS file that goes in the build. + * [ ] How to cite, by using ~~`@projectName`~~ an example in the PDF + frontmatter. * [ ] Localization: - * [ ] Make sure to properly localized the build date string. + * [ ] Make sure to properly localize the build date string. * [ ] Setup a PO-file workflow for translating the structure and templates? * [ ] Formats: * [ ] Fix the EPUB output: @@ -53,23 +48,32 @@ * [ ] ZIM format using the `zim-tools` package for the book and the notes. * [ ] Update the current available output formats. * [ ] Backmatter: - * [ ] Customized lists of definitions, hypothesis, etimologies, examples etc in the PDF version: + * [ ] Customized lists of definitions, hypothesis, etimologies, examples etc + in the PDF version: https://tex.stackexchange.com/questions/180747/editing-format-of-list-of-theorems-in-thmtools https://tex.stackexchange.com/questions/16494/generating-lists-of-custom-environment * [ ] Lists of definitions, hypothesis, etimologies, examples etc in the HTML version. Possible implementations: https://stackoverflow.com/questions/40735727/create-index-of-definitions-theorems-at-end-of-bookdown-book?rq=4 + * [ ] Backcover. + * [ ] Book flaps (and/or dust jacket). * [ ] Misc: * [ ] Spell checking as a `Makefile` target. * [ ] Suport for a `BASE_URL` environment variable? It would be applied as a template variable in `%%base_url%%` placeholers, allowing the compile material to have links among themselves. - * [ ] Optionally add a small reference to the Bookup website in the book - frontmatter? + * [ ] Add a small reference to the Bookup website in PDF book frontmatter. ## Documentation * [ ] Improve the documentation. +* [ ] Add that, with Bookup, books can be written and logged like another + coding project: good practices learned from computer programming can + be fed back into book writing. +* [ ] Tell about _living books_, meant to be versioned, have feeds and an + archive, so others can properly follow updates and cite specific versions. +* [ ] Document the "Bookup Stack": which piece of software is at which level, + and used for what. * [ ] Add a reference to: * [ ] Books using Bookup. * [ ] Similar projects, like: diff --git a/_changelog.yml b/_changelog.yml new file mode 100644 index 0000000..27827ae --- /dev/null +++ b/_changelog.yml @@ -0,0 +1,387 @@ +--- +changelog: Changelog +version: Version +help: This section can be used to register changes in the text versions. +versions: + #- id: + # date_atom: + # date_rss: + # date_markdown: + # summary: | + + - id: 0.6.0 + date_atom: + date_rss: + date_markdown: unreleased + summary: | + * Check for `snippets/changes.md`. + + - id: 0.5.9 + date_atom: 2025-11-23T10:22:00-03:00 + date_rss: 23 Nov 2025 10:22:00 -0300 + date_markdown: 2025-11-23 + summary: | + * Fix href attribute syntax in the pt-br template. + + - id: 0.5.8 + date_atom: 2025-11-23T09:55:00-03:00 + date_rss: 23 Nov 2025 09:55:00 -0300 + date_markdown: 2025-11-23 + summary: | + * Additional fix for Atom and RSS feed generation when Bookup is + vendorized. + + - id: 0.5.7 + date_atom: 2025-11-23T09:50:00-03:00 + date_rss: 23 Nov 2025 09:50:00 -0300 + date_markdown: 2025-11-23 + summary: | + * Fix Atom and RSS feed generation when Bookup is vendorized. + + - id: 0.5.6 + date_atom: 2025-11-23T09:45:00-03:00 + date_rss: 23 Nov 2025 09:45:00 -0300 + date_markdown: 2025-11-23 + summary: | + * Fix changelog generation when Bookup is vendorized. + + - id: 0.5.5 + date_atom: 2025-11-23T09:30:00-03:00 + date_rss: 23 Nov 2025 09:30:00 -0300 + date_markdown: 2025-11-23 + summary: | + * Fix Atom dates in changelog entries. + * Add consistent anchors to changelog entries in the Markdown output. + + - id: 0.5.4 + date_atom: 2025-11-23T09:20:00-03:00 + date_rss: 23 Nov 2025 09:20:00 -0300 + date_markdown: 2025-11-23 + summary: | + * Do not include version in feeds if the dates are empty. + * Fix changelog entries. + * Merge changelog entries in a single source file. + * Make sure `changelog.md` is converted as Markdown. + + - id: 0.5.3 + date_atom: 2025-11-22T23:12:00-03:00 + date_rss: 22 Nov 2025 23:12:00 -0300 + date_markdown: 2025-11-22 + summary: | + * Rename `_changes.yml` as `_changelog.yml`. + + - id: 0.5.2 + date_atom: 2025-11-22T23:00:00-03:00 + date_rss: 22 Nov 2025 23:00:00 -0300 + date_markdown: 2025-11-22 + summary: | + * Link the change log in the HTML frontmatter. + * Add a small reference to the Bookup website in the HTML frontmatter. + + - id: 0.5.1 + date_atom: 2025-11-22T22:50:00-03:00 + date_rss: 22 Nov 2025 22:50:00 -0300 + date_markdown: 2025-11-22 + summary: | + * Minor fixes in the RSS and Atom generation. + + - id: 0.5.0 + date_atom: 2025-11-22T21:30:00-03:00 + date_rss: 22 Nov 2025 21:30:00 -0300 + date_markdown: 2025-11-22 + summary: | + * Changelog improvements: + * Considered to build the recent changes section through a `snippets/changes.md` file. + This was partially implemented, but commented. + Then moved in favor of a YAML file, documented below. + * Build the recent changes using a `snippets/changes.yml` + or just `_changes.yml` that gets compiled into a `snippets/changes.md` + and into RSS and Atom files that goes in the build. + Adapted from example available at + https://recursewithless.net/projects/pandoc-feeds.html + * Added RSS/Atom feed support, adapted from recipe available at + https://recursewithless.net/projects/pandoc-feeds.html. + * Add RSS/Atom `rel` elements in the HTML head. + * Validate the generated feeds (RSS and Atom). + * Add a regular link like "Follow updates in this book". + * Document the feature. + + - id: 0.4.1 + date_atom: 2025-11-20T23:59:00-03:00 + date_rss: 20 Nov 2025 23:59:00 -0300 + date_markdown: 2025-11-20 + summary: | + * Add anchors in the notebook HTML preamble. + + - id: 0.4.0 + date_atom: 2025-11-20T22:59:00-03:00 + date_rss: 20 Nov 2025 22:59:00 -0300 + date_markdown: 2025-11-20 + summary: | + * Add anchors in the HTML preamble. + + - id: 0.3.3 + date_atom: 2025-11-18T23:59:00-03:00 + date_rss: 18 Nov 2025 23:59:00 -0300 + date_markdown: 2025-11-18 + summary: | + * Minor fix int the frontmatter citation mechanism. + + - id: 0.3.2 + date_atom: 2025-11-11T22:59:00-03:00 + date_rss: 18 Nov 2025 22:59:00 -0300 + date_markdown: 2025-11-18 + summary: | + * Support for separate publisher URL snippet. + + - id: 0.3.1 + date_atom: 2025-11-18T21:59:00-03:00 + date_rss: 18 Nov 2025 21:59:00 -0300 + date_markdown: 2025-11-18 + summary: | + * Apply fixes to the frontmatter citation mechanism. + + - id: 0.3.0 + date_atom: 2025-11-18T20:59:00-03:00 + date_rss: 18 Nov 2025 20:59:00 -0300 + date_markdown: 2025-11-18 + summary: | + * Citation: + * How to cite, by using ~~`@projectName`~~ an example in the HTML + frontmatter. + + - id: 0.2.5 + date_atom: 2025-11-18T19:59:00-03:00 + date_rss: 18 Nov 2025 19:59:00 -0300 + date_markdown: 2025-01-18 + summary: | + * Fix lookup for `js` folder for notes when the book is built under + `build/book` (then search won't work because `build/book/js` won't be + available). + + - id: 0.2.4 + date_atom: 2024-10-06T23:59:00-03:00 + date_rss: 06 Oct 2024 23:59:00 -0300 + date_markdown: 2024-10-06 + summary: | + * Apply the previous `NULL` fix to the portuguese template. + + - id: 0.2.3 + date_atom: 2024-10-06T22:59:00-03:00 + date_rss: 06 Oct 2024 22:59:00 -0300 + date_markdown: 2024-10-06 + summary: | + * Fix a `NULL` at the end of TOC in the PDF version. + It was inserted at the TeX source, due to an empty `R` block. + * Removes the unused `biblio-style` config. + + - id: 0.2.2 + date_atom: 2024-09-29T23:59:00-03:00 + date_rss: 29 Sep 2024 23:59:00 -0300 + date_markdown: 2024-09-29 + summary: | + * Display label before the book URL. + + * Fix publisher metadata information on the PDF output. + This required changing changing the "publisher" + metadata from `_common.yml` to `snippets/publisher.txt`. + + - id: 0.2.1 + date_atom: 2024-09-16T23:59:00-03:00 + date_rss: 16 Sep 2024 23:59:00 -0300 + date_markdown: 2024-09-16 + summary: | + * Fix TOC spacing between section numbers and section titles when there + are many sections making the section number too big. + + - id: 0.2.0 + date_atom: 2024-08-16T23:59:00-03:00 + date_rss: 16 Aug 2024 23:59:00 -0300 + date_markdown: 2024-08-16 + summary: | + * Provision: ensure a recent ggplot2 is used. + + - id: 0.1.9 + date_atom: 2024-07-13T23:59:00-03:00 + date_rss: 13 Jul 2024 23:59:00 -0300 + date_markdown: 2024-07-13 + summary: | + * Fix link to the Bookup site in the documentation. + + - id: 0.1.8 + date_atom: 2024-07-13T22:59:00-03:00 + date_rss: 13 Jul 2024 22:59:00 -0300 + date_markdown: 2024-07-13 + summary: | + * Template translation fix. + * Put list of etimologies before the list of definitions, + as they may usually come first (at least historically). + + - id: 0.1.7 + date_atom: 2024-06-29T23:59:00-03:00 + date_rss: 29 Jun 2024 23:59:00 -0300 + date_markdown: 2024-06-29 + summary: | + * Do not include the references block at the end of every file processed. + + - id: 0.1.6 + date_atom: 2024-06-19T23:59:00-03:00 + date_rss: 19 Jun 2024 23:59:00 -0300 + date_markdown: 2024-06-19 + summary: | + * Apply fixes to the archive/permalink logic. + + - id: 0.1.5 + date_atom: 2024-06-19T22:59:00-03:00 + date_rss: 19 Jun 2024 22:59:00 -0300 + date_markdown: 2024-06-19 + summary: | + * Archive after doing a build, making sure that the current tag is already + in the archive (and hence can have a permalink upfront). + + - id: 0.1.4 + date_atom: 2024-06-11T23:59:00-03:00 + date_rss: 11 Jun 2024 23:59:00 -0300 + date_markdown: 2024-06-11 + summary: | + * Fixes: + * Make sure the archive folder has some basic links. + * Features: + * Fine-grained control of lists of tables, figures etc. + * Scaffolding to support a "Recent changes" section in the compiled book. + * Documentation: Bookup features, and minor fixes. + * Misc: + * Considered to move `slides` to `content/slides`, but decided to not + do it for now. + + - id: 0.1.3 + date_atom: 2024-06-10T23:59:00-03:00 + date_rss: 10 Jun 2024 23:59:00 -0300 + date_markdown: 2024-06-10 + summary: | + * Fixes: + * Fix bibliography handling. + + - id: 0.1.2 + date_atom: 2024-06-10T22:59:00-03:00 + date_rss: 10 Jun 2024 22:59:00 -0300 + date_markdown: 2024-06-10 + summary: | + * Features: + * Improved BibTeX bibliography handling. + + - id: 0.1.1 + date_atom: 2024-06-10T21:59:00-03:00 + date_rss: 10 Jun 2024 21:59:00 -0300 + date_markdown: 2024-06-10 + summary: | + * Fixes: + * GitLab pages. + + - id: 0.1.0 + date_atom: 2024-06-10T20:59:00-03:00 + date_rss: 10 Jun 2024 20:59:00 -0300 + date_markdown: 2024-06-10 + summary: | + * Fixes: + * Cover page dimensions. + + - id: 0.0.9 + date_atom: 2024-06-10T19:59:00-03:00 + date_rss: 10 Jun 2024 19:59:00 -0300 + date_markdown: 2024-06-10 + summary: | + * Fixes: + * GitLab pages. + + - id: 0.0.8 + date_atom: 2024-06-10T18:59:00-03:00 + date_rss: 10 Jun 2024 18:59:00 -0300 + date_markdown: 2024-06-10 + summary: | + * Features: + * Localization support: + * Detect the `lang` YAML parameters and use templates from + `{templates,structure}/{book,notes}/$lang`. + * Compile the `_output.yml` from a template, setting the `includes` + from the appropriate language-based structure files. + * Translate documentation to English. + + - id: 0.0.7 + date_atom: 2024-06-09T23:59:00-03:00 + date_rss: 09 Jun 2024 23:59:00 -0300 + date_markdown: 2024-06-09 + summary: | + * Features: + * GitLab CI. + + - id: 0.0.6 + date_atom: 2024-06-09T22:59:00-03:00 + date_rss: 09 Jun 2024 22:59:00 -0300 + date_markdown: 2024-06-09 + summary: | + * Features: + * Notebook: + * Add link to the notebook in the main book HTML. + * Add license and version information in the notebook. + * Add the repository URL into the + documentation. + * Improvements towards localization. + * Issues: + * Add a `test` folder for quick experiments. + + - id: 0.0.5 + date_atom: 2024-06-09T21:59:00-03:00 + date_rss: 09 Jun 2024 21:59:00 -0300 + date_markdown: 2024-06-09 + summary: | + * Features: + * Improved compilation procedures. + * Unified configuration for book and notes. + + - id: 0.0.4 + date_atom: 2024-06-08T23:59:00-03:00 + date_rss: 08 Jun 2024 23:59:00 -0300 + date_markdown: 2024-06-08 + summary: | + * Fixes: + * Use `book` instead of `compiled`. + * Use `build` instead of `public`. + * Use `content/sections` instead of `content/published`. + * List of definitions and etimologies breaks build if they're empty + (`99-end.tex`). + * Misc: + * Considered to setup a testbed for quickly trying things. + But decided that's not needed for now, as it's possible to simply try + on this repository directly. + + - id: 0.0.3 + date_atom: 2024-06-08T22:59:00-03:00 + date_rss: 08 Jun 2024 22:59:00 -0300 + date_markdown: 2024-06-08 + summary: | + * Features: + * Notebook support. + * Website support. + + - id: 0.0.2 + date_atom: 2024-06-06T23:59:00-03:00 + date_rss: 06 Jun 2024 23:59:00 -0300 + date_markdown: 2024-06-06 + summary: | + * Features: + * Improved documentation. + + - id: 0.0.1 + date_atom: 2024-06-06T22:59:00-03:00 + date_rss: 06 Jun 2024 22:59:00 -0300 + date_markdown: 2024-06-06 + summary: | + * Features: + * Package a Bookdown-based publishing solution in a project named `bookup` + ("a bookdown-based publishing solution") + or similar, to ease book editing and authorship. + * Use the repository [ensaios][] as base. + * Create a basic documentation. + + [ensaios]: https://ensaios.fluxo.info diff --git a/_output.yml b/_output.yml index abd08d4..6435fd5 100644 --- a/_output.yml +++ b/_output.yml @@ -49,6 +49,9 @@ bookdown::gitbook: # Check ChangeLog entry from 2024-03-24 on the `ensaios` repository md_extensions: -example_lists + includes: + in_header: vendor/bookup/structure/book/en/00-header.html + # Tufte Book 2 # See https://rdrr.io/cran/bookdown/man/pdf_book.html bookdown::tufte_book2: diff --git a/bin/archive b/bin/archive index 4d4c37a..d79d411 100755 --- a/bin/archive +++ b/bin/archive @@ -10,7 +10,9 @@ 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`" +#REVISION="`git describe --tags 2> /dev/null || git log -1 --format=oneline | cut -d ' ' -f 1`" +METADATA=".metadata" +LATEST="$METADATA/latest.txt" # Determine the revision file if [ -e "$ASSETS/revision" ]; then @@ -39,24 +41,24 @@ if [ ! -e "$REVFILE" ]; then echo "# $BASENAME: skipping: revision file not found" exit else - OLD_REVISION="`cat $REVFILE`" + REVISION="`cat $REVFILE`" fi # Check for non-null revision -if [ -z "$OLD_REVISION" ]; then +if [ -z "$REVISION" ]; then echo "# $BASENAME: skipping: old revision is null" exit fi -# Check if it's a tag -if git tag | grep -q "^${OLD_REVISION}"; then +# Check if the revision is a tag +if git tag | grep -q "^${REVISION}$"; then # Check if archive does not exists - if [ ! -d "$ARCHIVE/$OLD_REVISION" ]; then - echo "# $BASENAME: archiving $OLD_REVISION..." - cp -alf $ASSETS $ARCHIVE/$OLD_REVISION + if [ ! -d "$ARCHIVE/$REVISION" ]; then + echo "# $BASENAME: archiving $REVISION..." + cp -alf $ASSETS $ARCHIVE/$REVISION else - echo "# $BASENAME: revision $OLD_REVISION already archived" + echo "# $BASENAME: revision $REVISION already archived" fi else - echo "# $BASENAME: not archiving: revision $OLD_REVISION is not a tag" + echo "# $BASENAME: not archiving: revision $REVISION is not a tag" fi diff --git a/bin/assemble b/bin/assemble index 04ae785..4c9d81c 100755 --- a/bin/assemble +++ b/bin/assemble @@ -32,3 +32,13 @@ fi if [ -e "$NOTEBOOK" ]; then mv $NOTEBOOK $BUILD/notes fi + +# Move Atom feed +if [ -e "atom.xml" ]; then + mv atom.xml $BUILD +fi + +# Move RSS feed +if [ -e "rss.xml" ]; then + mv rss.xml $BUILD +fi diff --git a/bin/compile-book b/bin/compile-book index e68a36d..a068fe7 100755 --- a/bin/compile-book +++ b/bin/compile-book @@ -12,6 +12,8 @@ OUTPUT="${1:-book}" REVISION="$2" DATE="$3" LANG="`grep lang _common.yml _book.yml _notes.yml 2> /dev/null | tail -1 | cut -d : -f 3 | sed -e 's/"//g' -e 's/ //g'`" +METADATA=".metadata" +LATEST="$METADATA/latest.txt" # Set the language if [ -z "$LANG" ]; then @@ -32,6 +34,9 @@ rm -f $OUTPUT.md $OUTPUT.Rmd cat _book.yml >> $OUTPUT.md ; echo "" >> $OUTPUT.md cat _common.yml >> $OUTPUT.md ; echo "" >> $OUTPUT.md +# Build changelog +$DIRNAME/compile-changelog + # Bibliography $BASEDIR/bin/biblio-yml > _biblio.yml cat _biblio.yml >> $OUTPUT.md @@ -74,3 +79,10 @@ fi # Symlink as a Bookdown source ln -sf $OUTPUT.md $OUTPUT.Rmd + +# Check if the revision is a tag +if git tag | grep -q "^${REVISION}$"; then + # Save info on the latest tagged release + mkdir -p $METADATA + echo $REVISION > $LATEST +fi diff --git a/bin/compile-changelog b/bin/compile-changelog new file mode 100755 index 0000000..862df31 --- /dev/null +++ b/bin/compile-changelog @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# +# Feed compiler +# Based on https://recursewithless.net/projects/pandoc-feeds.html +# + +# Parameters +BASENAME="`basename $0 | sed -e 's/\(.\)/\U\1/'`" +DIRNAME="`dirname $0`" +BASEDIR="$DIRNAME/.." +CHANGES="_changelog.yml" +CHANGELOG="content/notes/00-changelog/changelog.md" +BOOK="_book.yml" +COMMON="_common.yml" +META=".metadata/feed.yml" +RSS_TMPL="$BASEDIR/templates/rss.xml" +ATOM_TMPL="$BASEDIR/templates/atom.xml" +CHANGELOG_TMPL="$BASEDIR/templates/changelog.md" +CHANGES_TMPL="$BASEDIR/templates/_changelog.yml" +URL="snippets/url.txt" +CONTACT="snippets/contact.txt" + +# Ensure the changes file exists +if [ ! -e "$CHANGES" ]; then + # Create sample $CHANGES file + cp $CHANGES_TMPL $CHANGES +fi + +# Create .metadata/feed.yaml with the needed metadata +mkdir -p "`dirname $META`" +echo '---' > $META +echo "url: $(cat $URL)" >> $META +echo "email: $(cat $CONTACT)" >> $META + +# Generate the Atom feed +pandoc -M updated="$(LC_ALL=C date --iso-8601='seconds')" \ + --metadata-file=$META \ + --metadata-file=$CHANGES \ + --metadata-file=$BOOK \ + --metadata-file=$COMMON \ + --template=$ATOM_TMPL \ + -t plain \ + -o atom.xml < /dev/null + +# Generate the RSS feed +pandoc -M updated="$(LC_ALL=C date '+%d %b %Y %T %z')" \ + --metadata-file=$META \ + --metadata-file=$CHANGES \ + --metadata-file=$BOOK \ + --metadata-file=$COMMON \ + --template=$RSS_TMPL \ + -t plain \ + -o rss.xml < /dev/null + +# Generate changelog.md +mkdir -p "`dirname $CHANGELOG`" +pandoc \ + --metadata-file=$META \ + --metadata-file=$CHANGES \ + --metadata-file=$BOOK \ + --metadata-file=$COMMON \ + --template=$CHANGELOG_TMPL \ + -t markdown \ + -o $CHANGELOG < /dev/null + +# Fix list formatting in the Markdown output +sed -i -e 's/- /* /' $CHANGELOG diff --git a/content/notes/00-changelog/changelog.md b/content/notes/00-changelog/changelog.md new file mode 100644 index 0000000..0687c17 --- /dev/null +++ b/content/notes/00-changelog/changelog.md @@ -0,0 +1,254 @@ +# Changelog {#changelog .unnumbered} + +<!-- DO NOT manually edit this file: it's generated from _changes.yml --> +<!-- Any updates here will be overwritten --> + +This section can be used to register changes in the text versions. + +## Version 0.5.9 - 2025-11-23 {#v0.5.9 .unnumbered} + +* Fix href attribute syntax in the pt-br template. + +## Version 0.5.8 - 2025-11-23 {#v0.5.8 .unnumbered} + +* Additional fix for Atom and RSS feed generation when Bookup is + vendorized. + +## Version 0.5.7 - 2025-11-23 {#v0.5.7 .unnumbered} + +* Fix Atom and RSS feed generation when Bookup is vendorized. + +## Version 0.5.6 - 2025-11-23 {#v0.5.6 .unnumbered} + +* Fix changelog generation when Bookup is vendorized. + +## Version 0.5.5 - 2025-11-23 {#v0.5.5 .unnumbered} + +* Fix Atom dates in changelog entries. +* Add consistent anchors to changelog entries in the Markdown output. + +## Version 0.5.4 - 2025-11-23 {#v0.5.4 .unnumbered} + +* Do not include version in feeds if the dates are empty. +* Fix changelog entries. +* Merge changelog entries in a single source file. +* Make sure `changelog.md` is converted as Markdown. + +## Version 0.5.3 - 2025-11-22 {#v0.5.3 .unnumbered} + +* Rename `_changes.yml` as `_changelog.yml`. + +## Version 0.5.2 - 2025-11-22 {#v0.5.2 .unnumbered} + +* Link the change log in the HTML frontmatter. +* Add a small reference to the Bookup website in the HTML frontmatter. + +## Version 0.5.1 - 2025-11-22 {#v0.5.1 .unnumbered} + +* Minor fixes in the RSS and Atom generation. + +## Version 0.5.0 - 2025-11-22 {#v0.5.0 .unnumbered} + +* Changelog improvements: + * Considered to build the recent changes section through a + `snippets/changes.md` file. This was partially implemented, but + commented. Then moved in favor of a YAML file, documented below. + * Build the recent changes using a `snippets/changes.yml` or just + `_changes.yml` that gets compiled into a `snippets/changes.md` + and into RSS and Atom files that goes in the build. Adapted from + example available at + https://recursewithless.net/projects/pandoc-feeds.html + * Added RSS/Atom feed support, adapted from recipe available at + https://recursewithless.net/projects/pandoc-feeds.html. + * Add RSS/Atom `rel` elements in the HTML head. + * Validate the generated feeds (RSS and Atom). + * Add a regular link like "Follow updates in this book". + * Document the feature. + +## Version 0.4.1 - 2025-11-20 {#v0.4.1 .unnumbered} + +* Add anchors in the notebook HTML preamble. + +## Version 0.4.0 - 2025-11-20 {#v0.4.0 .unnumbered} + +* Add anchors in the HTML preamble. + +## Version 0.3.3 - 2025-11-18 {#v0.3.3 .unnumbered} + +* Minor fix int the frontmatter citation mechanism. + +## Version 0.3.2 - 2025-11-18 {#v0.3.2 .unnumbered} + +* Support for separate publisher URL snippet. + +## Version 0.3.1 - 2025-11-18 {#v0.3.1 .unnumbered} + +* Apply fixes to the frontmatter citation mechanism. + +## Version 0.3.0 - 2025-11-18 {#v0.3.0 .unnumbered} + +* Citation: + * How to cite, by using ~~`@projectName`~~ an example in the HTML + frontmatter. + +## Version 0.2.5 - 2025-01-18 {#v0.2.5 .unnumbered} + +* Fix lookup for `js` folder for notes when the book is built under + `build/book` (then search won't work because `build/book/js` won't + be available). + +## Version 0.2.4 - 2024-10-06 {#v0.2.4 .unnumbered} + +* Apply the previous `NULL` fix to the portuguese template. + +## Version 0.2.3 - 2024-10-06 {#v0.2.3 .unnumbered} + +* Fix a `NULL` at the end of TOC in the PDF version. It was inserted + at the TeX source, due to an empty `R` block. +* Removes the unused `biblio-style` config. + +## Version 0.2.2 - 2024-09-29 {#v0.2.2 .unnumbered} + +* Display label before the book URL. + +* Fix publisher metadata information on the PDF output. This required + changing changing the "publisher" metadata from `_common.yml` to + `snippets/publisher.txt`. + +## Version 0.2.1 - 2024-09-16 {#v0.2.1 .unnumbered} + +* Fix TOC spacing between section numbers and section titles when + there are many sections making the section number too big. + +## Version 0.2.0 - 2024-08-16 {#v0.2.0 .unnumbered} + +* Provision: ensure a recent ggplot2 is used. + +## Version 0.1.9 - 2024-07-13 {#v0.1.9 .unnumbered} + +* Fix link to the Bookup site in the documentation. + +## Version 0.1.8 - 2024-07-13 {#v0.1.8 .unnumbered} + +* Template translation fix. +* Put list of etimologies before the list of definitions, as they may + usually come first (at least historically). + +## Version 0.1.7 - 2024-06-29 {#v0.1.7 .unnumbered} + +* Do not include the references block at the end of every file + processed. + +## Version 0.1.6 - 2024-06-19 {#v0.1.6 .unnumbered} + +* Apply fixes to the archive/permalink logic. + +## Version 0.1.5 - 2024-06-19 {#v0.1.5 .unnumbered} + +* Archive after doing a build, making sure that the current tag is + already in the archive (and hence can have a permalink upfront). + +## Version 0.1.4 - 2024-06-11 {#v0.1.4 .unnumbered} + +* Fixes: + * Make sure the archive folder has some basic links. +* Features: + * Fine-grained control of lists of tables, figures etc. + * Scaffolding to support a "Recent changes" section in the + compiled book. + * Documentation: Bookup features, and minor fixes. +* Misc: + * Considered to move `slides` to `content/slides`, but decided to + not do it for now. + +## Version 0.1.3 - 2024-06-10 {#v0.1.3 .unnumbered} + +* Fixes: + * Fix bibliography handling. + +## Version 0.1.2 - 2024-06-10 {#v0.1.2 .unnumbered} + +* Features: + * Improved BibTeX bibliography handling. + +## Version 0.1.1 - 2024-06-10 {#v0.1.1 .unnumbered} + +* Fixes: + * GitLab pages. + +## Version 0.1.0 - 2024-06-10 {#v0.1.0 .unnumbered} + +* Fixes: + * Cover page dimensions. + +## Version 0.0.9 - 2024-06-10 {#v0.0.9 .unnumbered} + +* Fixes: + * GitLab pages. + +## Version 0.0.8 - 2024-06-10 {#v0.0.8 .unnumbered} + +* Features: + * Localization support: + * Detect the `lang` YAML parameters and use templates from + `{templates,structure}/{book,notes}/$lang`. + * Compile the `_output.yml` from a template, setting the + `includes` from the appropriate language-based structure + files. + * Translate documentation to English. + +## Version 0.0.7 - 2024-06-09 {#v0.0.7 .unnumbered} + +* Features: + * GitLab CI. + +## Version 0.0.6 - 2024-06-09 {#v0.0.6 .unnumbered} + +* Features: + * Notebook: + * Add link to the notebook in the main book HTML. + * Add license and version information in the notebook. + * Add the repository URL into the documentation. + * Improvements towards localization. +* Issues: + * Add a `test` folder for quick experiments. + +## Version 0.0.5 - 2024-06-09 {#v0.0.5 .unnumbered} + +* Features: + * Improved compilation procedures. + * Unified configuration for book and notes. + +## Version 0.0.4 - 2024-06-08 {#v0.0.4 .unnumbered} + +* Fixes: + * Use `book` instead of `compiled`. + * Use `build` instead of `public`. + * Use `content/sections` instead of `content/published`. + * List of definitions and etimologies breaks build if they're + empty (`99-end.tex`). +* Misc: + * Considered to setup a testbed for quickly trying things. But + decided that's not needed for now, as it's possible to simply + try on this repository directly. + +## Version 0.0.3 - 2024-06-08 {#v0.0.3 .unnumbered} + +* Features: + * Notebook support. + * Website support. + +## Version 0.0.2 - 2024-06-06 {#v0.0.2 .unnumbered} + +* Features: + * Improved documentation. + +## Version 0.0.1 - 2024-06-06 {#v0.0.1 .unnumbered} + +* Features: + * Package a Bookdown-based publishing solution in a project named + `bookup` ("a bookdown-based publishing solution") or similar, to + ease book editing and authorship. + * Use the repository [ensaios](https://ensaios.fluxo.info) as + base. + * Create a basic documentation. diff --git a/content/sections/02-features/features.md b/content/sections/02-features/features.md index 606ed1f..2f5aa08 100644 --- a/content/sections/02-features/features.md +++ b/content/sections/02-features/features.md @@ -17,6 +17,9 @@ Main Bookup features: * Adds the compilation metadata: * Version based on Git tag or commit. + * Compilation date. * Localization support: templates can be easily translated to other languages. + +* RSS, Atom and Markdown changelogs. diff --git a/content/sections/10-structure/structure.md b/content/sections/10-structure/structure.md index 263a764..b3432ff 100644 --- a/content/sections/10-structure/structure.md +++ b/content/sections/10-structure/structure.md @@ -21,3 +21,5 @@ A Bookup project folder structure looks like this: * `vendor/bookup`: where the Bookup codebase actually resides: * `content`: Bookup documentation. * `vendor/{Fuse.js,}`: dependencies. +* `_changelog.yml`: to track changes in your book, used to build RSS and Atom + feeds, as well as a ChangeLog in Markdown format. diff --git a/content/sections/15-installation/installation.md b/content/sections/15-installation/installation.md index d2133d2..8cfb941 100644 --- a/content/sections/15-installation/installation.md +++ b/content/sections/15-installation/installation.md @@ -22,7 +22,7 @@ Bookup installation procedure. * `LICENSE`. * `DISCLAIMER`. * `images/cover.png`. -* `snippets/{contact,cover,keywords,project,url,volume}.txt`. +* `snippets/{contact,cover,keywords,project,url,volume,publisher,publisher-url}.txt`. * `snippets/changes.md`. ## Optional files diff --git a/snippets/publisher-url.txt b/snippets/publisher-url.txt new file mode 100644 index 0000000..ca67d59 --- /dev/null +++ b/snippets/publisher-url.txt @@ -0,0 +1 @@ +https://bookup.fluxo.info diff --git a/snippets/publisher.txt b/snippets/publisher.txt index 1ead46a..f61ae73 100644 --- a/snippets/publisher.txt +++ b/snippets/publisher.txt @@ -1 +1 @@ -Bookup +Bookup Editions diff --git a/structure/book/en/00-header.html b/structure/book/en/00-header.html new file mode 100644 index 0000000..94b4620 --- /dev/null +++ b/structure/book/en/00-header.html @@ -0,0 +1,2 @@ +<link rel="alternate" type="application/atom+xml" href="/atom.xml" /> +<link rel="alternate" type="application/rss+xml" href="/rss.xml" /> diff --git a/structure/book/en/00-header.yml b/structure/book/en/00-header.yml index 2ad19fe..f56c37a 100644 --- a/structure/book/en/00-header.yml +++ b/structure/book/en/00-header.yml @@ -18,8 +18,9 @@ mainfont: "Linux Libertine O" monofont: "Liberation Mono" # Paper size -#papersize: a4paper #papersize: letterpaper +#papersize: a4paper +#papersize: a5paper papersize: b5paper # Geometry diff --git a/structure/book/en/00-preamble.md b/structure/book/en/00-preamble.md index cc6a3cb..e83f82b 100644 --- a/structure/book/en/00-preamble.md +++ b/structure/book/en/00-preamble.md @@ -9,7 +9,9 @@ if (knitr::is_html_output()) { cat("\n") cat('<img src="images/cover.png">') cat("\n") - cat("<h2>About</h2>") + cat("\n") + + cat("## About {#about .unlisted .unnumbered}") cat("\n") cat('<em>') cat(readLines('DISCLAIMER'), sep='\n') @@ -19,11 +21,13 @@ if (knitr::is_html_output()) { cat(readLines('.metadata/revision.txt'), sep='\n') cat('</em></strong> - compiled at <strong><em>') cat(readLines('.metadata/date.txt'), sep='\n') - cat('</em></strong>.') + cat('</em></strong> using <a href="https://bookup.fluxo.info">Bookup</a>.') cat('<br/>') cat('Older versions available in the <a href="/archive">archive</a>.') cat('<br/>') - cat('Notebook available <a href="/notes">here</a>.') + cat('Follow updates in this book: <a href="/rss.xml">RSS</a> / <a href="/atom.xml">Atom</a>.') + cat('<br/>') + cat('Notebook available <a href="/notes">here</a>, with a changelog <a href="/notes/changelog.html">here</a>.') cat('<br/><br/>') cat(readLines('snippets/project.txt')) cat(' - ') @@ -31,21 +35,44 @@ if (knitr::is_html_output()) { cat('<br/>') cat('Published by ') #cat(rmarkdown::metadata$publisher) - cat(readLines('snippets/publisher.txt')) + cat(readLines('snippets/publisher.txt'), ' - ', readLines('snippets/publisher-url.txt')) cat('<br/>') cat('Published at ') cat(readLines('snippets/url.txt'), sep='\n') cat('<br/><br/>') cat(readLines('snippets/keywords.txt'), sep='\n') cat("\n") - cat("<h2>Credits</h2>") + cat("\n") + + cat("## How to cite {#citing .unlisted .unnumbered}") + cat("\n") + library(stringr) + author = str_split_1(rmarkdown::metadata$author, ' ') + author_cite = paste(toupper(author[2]), author[1], sep=', ') + version = readLines('.metadata/latest.txt') + if (version != '0.0.0') { + archive = paste('archive', version, sep='/') + } + else { + archive = '' + } + + cat('Adapt the following example to your <a href="https://en.wikipedia.org/wiki/Citation" target="_blank">citation</a> standard (APA, ABNT etc) and also to the version you want to cite:<br/><br/>', sep='\n') + cat(paste('<blockquote><i>', author_cite, '. <b>', rmarkdown::metadata$title, '.</b> ', readLines('snippets/publisher.txt'), ', ', readLines('.metadata/year.txt'), ' - version ', version, ' - ', readLines('snippets/url.txt'), '/', archive, '</i></blockquote>', sep='')) + cat("\n") + cat("\n") + + cat("## Credits {#credits .unlisted .unnumbered}") cat("\n") cat(paste(rmarkdown::metadata$title, "<br/>", "Copyleft ©", readLines('.metadata/year.txt'), rmarkdown::metadata$author, readLines('snippets/contact.txt'), sep=' ')) cat('<br/><br/>') cat(readLines('LICENSE'), sep='\n') cat('<br/><br/>') cat(readLines('snippets/cover.txt'), sep='\n') - cat("<h2>PDF version</h2>") + cat("\n") + cat("\n") + + cat("## PDF version {#pdf .unlisted .unnumbered}") cat("\n") cat('Download the PDF <a href="book.pdf">here</a>, or browse it below:') cat("\n") diff --git a/structure/book/en/00-preamble.tex b/structure/book/en/00-preamble.tex index df9a166..d81eb2e 100644 --- a/structure/book/en/00-preamble.tex +++ b/structure/book/en/00-preamble.tex @@ -37,7 +37,7 @@ Copyleft \copyright\ \input{.metadata/year.txt} \thanklessauthor\ \input{snippe % https://www.typeerror.org/docs/latex/_005cprotect \par\smallcaps{\protect\input{snippets/project.txt} - \protect\input{snippets/volume.txt}} -\par\smallcaps{Published by \protect\input{snippets/publisher.txt}} +\par\smallcaps{Published by \protect\input{snippets/publisher.txt} - \protect\input{snippets/publisher-url.txt}} \par\smallcaps{Published at \protect\input{snippets/url.txt}} diff --git a/structure/book/en/99-end.md b/structure/book/en/99-end.md index d0c8b8d..6092e8f 100644 --- a/structure/book/en/99-end.md +++ b/structure/book/en/99-end.md @@ -12,7 +12,7 @@ <!-- This seems not to be the case anymore: https://bookdown.org/yihui/bookdown/citations.html --> <script type="text/html"> ```{r echo=FALSE, results='asis'} -if (knitr::is_html_output()) { +if (knitr::is_html_output() && file.exists('snippets/changed.md')) { cat(readLines('snippets/changes.md'), sep='\n') } ``` diff --git a/structure/book/pt-br/00-header.html b/structure/book/pt-br/00-header.html new file mode 100644 index 0000000..94b4620 --- /dev/null +++ b/structure/book/pt-br/00-header.html @@ -0,0 +1,2 @@ +<link rel="alternate" type="application/atom+xml" href="/atom.xml" /> +<link rel="alternate" type="application/rss+xml" href="/rss.xml" /> diff --git a/structure/book/pt-br/00-header.yml b/structure/book/pt-br/00-header.yml index 2ad19fe..f56c37a 100644 --- a/structure/book/pt-br/00-header.yml +++ b/structure/book/pt-br/00-header.yml @@ -18,8 +18,9 @@ mainfont: "Linux Libertine O" monofont: "Liberation Mono" # Paper size -#papersize: a4paper #papersize: letterpaper +#papersize: a4paper +#papersize: a5paper papersize: b5paper # Geometry diff --git a/structure/book/pt-br/00-preamble.md b/structure/book/pt-br/00-preamble.md index 367686d..2f26dc3 100644 --- a/structure/book/pt-br/00-preamble.md +++ b/structure/book/pt-br/00-preamble.md @@ -9,7 +9,9 @@ if (knitr::is_html_output()) { cat("\n") cat('<img src="images/cover.png">') cat("\n") - cat("<h2>Sobre</h2>") + cat("\n") + + cat("## Sobre {#about .unlisted .unnumbered}") cat("\n") cat('<em>') cat(readLines('DISCLAIMER'), sep='\n') @@ -19,11 +21,13 @@ if (knitr::is_html_output()) { cat(readLines('.metadata/revision.txt'), sep='\n') cat('</em></strong> - compilada em <strong><em>') cat(readLines('.metadata/date.txt'), sep='\n') - cat('</em></strong>.') + cat('</em></strong> usando <a href="https://bookup.fluxo.info">Bookup</a>.') cat('<br/>') cat('Versões anteriores disponíveis no <a href="/archive">arquivo</a>.') cat('<br/>') - cat('Caderno de anotações disponível <a href="/notes">aqui</a>.') + cat('Acompanhe as atualizações deste livro: <a href="/rss.xml">RSS</a> / <a href="/atom.xml">Atom</a>.') + cat('<br/>') + cat('Caderno de anotações disponível <a href="/notes">aqui</a>, com um registro de mudanças <a href="/notes/changelog.html">aqui</a>.') cat('<br/><br/>') cat(readLines('snippets/project.txt')) cat(' - ') @@ -31,21 +35,45 @@ if (knitr::is_html_output()) { cat('<br/>') cat('Publicado por ') #cat(rmarkdown::metadata$publisher) - cat(readLines('snippets/publisher.txt')) + cat(readLines('snippets/publisher.txt'), ' - ', readLines('snippets/publisher-url.txt')) cat('<br/>') cat('Publicado em ') cat(readLines('snippets/url.txt'), sep='\n') cat('<br/><br/>') cat(readLines('snippets/keywords.txt'), sep='\n') cat("\n") - cat("<h2>Créditos</h2>") + cat("\n") + + cat("## Como citar {#citing .unlisted .unnumbered}") + cat("\n") + + library(stringr) + author = str_split_1(rmarkdown::metadata$author, ' ') + author_cite = paste(toupper(author[2]), author[1], sep=', ') + version = readLines('.metadata/latest.txt') + if (version != '0.0.0') { + archive = paste('archive', version, sep='/') + } + else { + archive = '' + } + + cat('Adapte o exemplo a seguir para o seu padrão de <a href="https://pt.wikipedia.org/wiki/Cita%C3%A7%C3%A3o" target="_blank">citação</a> (ABNT, APA etc) e também para a versão que você quer citar:<br/><br/>', sep='\n') + cat(paste('<blockquote><i>', author_cite, '. <b>', rmarkdown::metadata$title, '.</b> ', readLines('snippets/publisher.txt'), ', ', readLines('.metadata/year.txt'), ' - versão ', version, ' - ', readLines('snippets/url.txt'), '/', archive, '</i></blockquote>', sep='')) + cat("\n") + cat("\n") + + cat("## Créditos {#credits .unlisted .unnumbered}") cat("\n") cat(paste(rmarkdown::metadata$title, "<br/>", "Copyleft ©", readLines('.metadata/year.txt'), rmarkdown::metadata$author, readLines('snippets/contact.txt'), sep=' ')) cat('<br/><br/>') cat(readLines('LICENSE'), sep='\n') cat('<br/><br/>') cat(readLines('snippets/cover.txt'), sep='\n') - cat("<h2>Versão PDF</h2>") + cat("\n") + cat("\n") + + cat("## Versão PDF {#pdf .unlisted .unnumbered}") cat("\n") cat('Baixe a versão PDF <a href="book.pdf">aqui</a>, ou navegue abaixo:') cat("\n") diff --git a/structure/book/pt-br/00-preamble.tex b/structure/book/pt-br/00-preamble.tex index a867bd6..5c58743 100644 --- a/structure/book/pt-br/00-preamble.tex +++ b/structure/book/pt-br/00-preamble.tex @@ -37,7 +37,7 @@ Copyleft \copyright\ \input{.metadata/year.txt} \thanklessauthor\ \input{snippe % https://www.typeerror.org/docs/latex/_005cprotect \par\smallcaps{\protect\input{snippets/project.txt} - \protect\input{snippets/volume.txt}} -\par\smallcaps{Publicado por \protect\input{snippets/publisher.txt}} +\par\smallcaps{Publicado por \protect\input{snippets/publisher.txt} - \protect\input{snippets/publisher-url.txt}} \par\smallcaps{Publicado em \protect\input{snippets/url.txt}} diff --git a/structure/book/pt-br/99-end.md b/structure/book/pt-br/99-end.md index ba2d787..f5734eb 100644 --- a/structure/book/pt-br/99-end.md +++ b/structure/book/pt-br/99-end.md @@ -12,7 +12,7 @@ <!-- This seems not to be the case anymore: https://bookdown.org/yihui/bookdown/citations.html --> <script type="text/html"> ```{r echo=FALSE, results='asis'} -if (knitr::is_html_output()) { +if (knitr::is_html_output() && file.exists('snippets/changed.md')) { cat(readLines('snippets/changes.md'), sep='\n') } ``` diff --git a/structure/notes/en/00-preamble.md b/structure/notes/en/00-preamble.md index 4490a20..d683e16 100644 --- a/structure/notes/en/00-preamble.md +++ b/structure/notes/en/00-preamble.md @@ -9,7 +9,9 @@ if (knitr::is_html_output()) { cat("\n") cat('<img src="images/cover.png">') cat("\n") - cat("<h2>About</h2>") + cat("\n") + + cat("## About {#about .unlisted .unnumbered}") cat("\n") cat('<em>') cat(readLines('DISCLAIMER'), sep='\n') @@ -22,7 +24,9 @@ if (knitr::is_html_output()) { cat('</em></strong>.') cat('<br/><br/>') cat("\n") - cat("<h2>Credits</h2>") + cat("\n") + + cat("## Credits {#credits .unlisted .unnumbered}") cat("\n") cat(paste(rmarkdown::metadata$title, "<br/>", "Copyleft ©", readLines('.metadata/year.txt'), rmarkdown::metadata$author, readLines('snippets/contact.txt'), sep=' ')) cat('<br/><br/>') diff --git a/structure/notes/pt-br/00-preamble.md b/structure/notes/pt-br/00-preamble.md index 37d097e..1fc370c 100644 --- a/structure/notes/pt-br/00-preamble.md +++ b/structure/notes/pt-br/00-preamble.md @@ -9,7 +9,9 @@ if (knitr::is_html_output()) { cat("\n") cat('<img src="images/cover.png">') cat("\n") - cat("<h2>Sobre</h2>") + cat("\n") + + cat("## Sobre {#about .unlisted .unnumbered}") cat("\n") cat('<em>') cat(readLines('DISCLAIMER'), sep='\n') @@ -22,7 +24,9 @@ if (knitr::is_html_output()) { cat('</em></strong>.') cat('<br/><br/>') cat("\n") - cat("<h2>Créditos</h2>") + cat("\n") + + cat("## Créditos {#credits .unlisted .unnumbered}") cat("\n") cat(paste(rmarkdown::metadata$title, "<br/>", "Copyleft ©", readLines('.metadata/year.txt'), rmarkdown::metadata$author, readLines('snippets/contact.txt'), sep=' ')) cat('<br/><br/>') diff --git a/templates/_changelog.yml b/templates/_changelog.yml new file mode 100644 index 0000000..4e9aac8 --- /dev/null +++ b/templates/_changelog.yml @@ -0,0 +1,19 @@ +--- +# Each entry should have the date all supported formats (Atom, RSS and Markdown) +changelog: Changelog +version: Version +help: This section can be used to register changes in the text versions. +versions: + - id: + date_atom: + date_rss: + date_markdown: + summary: | + + # Example + #- id: 0.1.0 + # date_atom: 2025-11-22T21:30:00-03:00 + # date_rss: 22 Nov 2025 21:30:00 -0300 + # date_markdown: 2025-11-22 + # summary: | + # * Initial version. diff --git a/templates/_output.yml b/templates/_output.yml index e641047..040f712 100644 --- a/templates/_output.yml +++ b/templates/_output.yml @@ -49,6 +49,9 @@ bookdown::gitbook: # Check ChangeLog entry from 2024-03-24 on the `ensaios` repository md_extensions: -example_lists + includes: + in_header: vendor/bookup/structure/book/en/00-header.html + # Tufte Book 2 # See https://rdrr.io/cran/bookdown/man/pdf_book.html bookdown::tufte_book2: diff --git a/templates/atom.xml b/templates/atom.xml new file mode 100644 index 0000000..80e2489 --- /dev/null +++ b/templates/atom.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + <author> + <name>$author$</name> + <email>$email$</email> + </author> + <title>$title$</title> + <id>$url$/</id> + <link rel="self" href="$url$/atom.xml" /> + <updated>$updated$</updated> + + $for(versions)$ + $if(versions.date_atom)$ + <entry> + <id>$url$/archive/$versions.id$</id> + <title>$version$ $versions.id$</title> + <updated>$versions.date_atom$</updated> + <link href="$url$/archive/$versions.id$" /> + <summary>$versions.summary$</summary> + </entry> + $endif$ + $endfor$ +</feed> diff --git a/templates/changelog.md b/templates/changelog.md new file mode 100644 index 0000000..9b9d8fc --- /dev/null +++ b/templates/changelog.md @@ -0,0 +1,12 @@ +# $changelog$ {#changelog .unnumbered} + +<!-- DO NOT manually edit this file: it's generated from _changes.yml --> +<!-- Any updates here will be overwritten --> + +$help$ +$for(versions)$ + +## $version$ $versions.id$ - $versions.date_markdown$ {#v$versions.id$ .unnumbered} + +$versions.summary$ +$endfor$ diff --git a/templates/rss.xml b/templates/rss.xml new file mode 100644 index 0000000..654bc1a --- /dev/null +++ b/templates/rss.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> +<channel> + <title>$title$</title> + <description>$subtitle$</description> + <link>$url$/</link> + <atom:link href="$url$/rss.xml" rel="self" type="application/rss+xml" /> + <lastBuildDate>$updated$</lastBuildDate> + <ttl>1440</ttl> + + $for(versions)$ + $if(versions.date_rss)$ + <item> + <title>$version$ $versions.id$</title> + <description>$versions.summary$</description> + <link>$url$/archive/$versions.id$</link> + <guid>$url$/archive/$versions.id$</guid> + <pubDate>$versions.date_rss$</pubDate> + </item> + $endif$ + $endfor$ +</channel> +</rss> |
