Skip to content

Commit 37e27f0

Browse files
authored
Merge pull request #173 from KubaO/staging
Add PDF download link to footer alongside offline copy.
2 parents f9345a5 + dad86a2 commit 37e27f0

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

builder/template.mjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ function renderFooterCustom(page, config) {
731731
function renderEditAndOfflineBlock(page, config) {
732732
const showEdit = config.gh_edit_link && config.gh_edit_link_text && config.gh_edit_repository
733733
&& config.gh_edit_branch && config.gh_edit_view_mode;
734-
const showOffline = config.gh_offline_link && config.gh_offline_link_text && config.gh_offline_link_url;
734+
const showOffline = config.gh_offline_link && config.gh_offline_link_url;
735735
const showLastModified = config.last_edit_timestamp && config.last_edit_time_format
736736
&& page.frontmatter.last_modified_date;
737737

@@ -755,9 +755,17 @@ function renderEditAndOfflineBlock(page, config) {
755755
` </p>\n`;
756756
}
757757
if (showOffline) {
758-
inner += ` <p class="text-small text-grey-dk-000 mb-0">\n` +
759-
` <a href="${escAttr(String(config.gh_offline_link_url))}" id="download-offline">${escText(String(config.gh_offline_link_text))}</a>\n` +
760-
` </p>\n`;
758+
const pdfUrl = config.gh_pdf_link_url ? String(config.gh_pdf_link_url) : null;
759+
const offlineHref = escAttr(String(config.gh_offline_link_url));
760+
if (pdfUrl) {
761+
inner += ` <p class="text-small text-grey-dk-000 mb-0">\n` +
762+
` Download <a href="${offlineHref}" id="download-offline">Offline Copy</a> or <a href="${escAttr(pdfUrl)}" id="download-pdf">PDF</a>.\n` +
763+
` </p>\n`;
764+
} else {
765+
inner += ` <p class="text-small text-grey-dk-000 mb-0">\n` +
766+
` <a href="${offlineHref}" id="download-offline">Offline Copy</a>\n` +
767+
` </p>\n`;
768+
}
761769
}
762770

763771
return ` <div class="d-flex mt-2">\n` + inner + ` </div>\n`;

docs/Documentation/Tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ The build pipeline also reads a handful of declarative files. They are not execu
128128

129129
| File | Effect |
130130
|---|---|
131-
| `docs/_config.yml` | Site config. `tbdocs` reads `url`, `baseurl`, `title`, `logo`, `also_build_offline`, `also_build_pdf`, `offline_exclude`, `exclude`, the footer / aux-link knobs, the GitHub edit-link knobs, and the offline-download-link knobs. Jekyll-only keys (`markdown`, `kramdown`, `theme`, `highlighter`, the `defaults` block, the `compress_html` block) are ignored. |
131+
| `docs/_config.yml` | Site config. `tbdocs` reads `url`, `baseurl`, `title`, `logo`, `also_build_offline`, `also_build_pdf`, `offline_exclude`, `exclude`, the footer / aux-link knobs, the GitHub edit-link knobs, and the download-link knobs (`gh_offline_link`, `gh_offline_link_url`, `gh_pdf_link_url`). Jekyll-only keys (`markdown`, `kramdown`, `theme`, `highlighter`, the `defaults` block, the `compress_html` block) are ignored. |
132132
| `docs/_book.yml` | The PDF book's chapter manifest. Entries are resolved to pages via the selector schema (`page` / `pages` / `nav_page` / `nav_pages` / `no_descent`) and control PDF outline behaviour via `landing_page:`, `landing_is_target:`, `no_outline_entry:`, `no_heading_shift:`, and `outline_closed:`. Full schema is documented in the file header. Phase 2 resolves chapter arrays; Phase 8 assembles `book.html`. |
133133
| `builder/themes/Light.theme`, `Dark.theme`, `Classic.theme` | twinBASIC IDE theme files, vendored from the BETA installer. `builder/highlight-theme.mjs` parses them into a Symbol-keyed palette that drives both the renderer's scope-to-class mapping and the generated `tb-highlight.css`. Refresh from the installer when the IDE adds new palette entries. |
134134
| `builder/twinbasic.tmLanguage.json` | TextMate grammar for the twinBASIC language. Shiki uses it to tokenise every ` ```tb ` code block. |

docs/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ gh_edit_view_mode: "tree"
4141
# it to fetch the offline copy, offline readers use it to refresh
4242
# theirs against the latest release.
4343
gh_offline_link: true
44-
gh_offline_link_text: "Download offline copy"
4544
gh_offline_link_url: "https://github.com/twinbasic/documentation/releases/latest/download/twinbasic-docs-offline.zip"
45+
gh_pdf_link_url: "https://github.com/twinbasic/documentation/releases/latest/download/twinBASIC.Book.pdf"
4646

4747
# When true, tbdocs's Phase 7 writes a `file://`-browsable mirror of
4848
# `_site/` to `_site-offline/` with every URL rewritten to a page-

0 commit comments

Comments
 (0)