24 Commits

Author SHA1 Message Date
95a20df58b enable publishing specific versions from workflow
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 15s
Build and test / build-and-test (20.x) (push) Successful in 17s
2025-04-20 13:50:02 -07:00
0452c5fcf0 0.2.1
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 1m13s
Build and test / build-and-test (20.x) (push) Successful in 18s
2025-04-20 13:18:15 -07:00
2636e42533 0.1.12
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 2m23s
Build and test / build-and-test (20.x) (push) Successful in 2m28s
2023-11-27 14:11:44 -08:00
1a09a51780 revert to color override; text not high-contrast enough on like backgrounds
Some checks failed
Build and test / build-and-test (20.x) (push) Waiting to run
Build and test / build-and-test (18.x) (push) Has been cancelled
2023-11-27 14:11:30 -08:00
beb80145a4 0.1.11
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 2m39s
Build and test / build-and-test (20.x) (push) Successful in 2m33s
2023-11-27 13:58:56 -08:00
0076cbb971 do not override text color if its already being set 2023-11-27 13:58:47 -08:00
bd9945b24b 0.1.10
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 2m47s
Build and test / build-and-test (20.x) (push) Successful in 2m13s
2023-11-27 11:41:21 -08:00
760af891c5 remove inline-flex from a default styles 2023-11-27 11:41:16 -08:00
f8b15f0ff4 0.1.9
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 7m55s
Build and test / build-and-test (20.x) (push) Successful in 3m11s
2023-11-26 21:46:01 -08:00
20e585e708 change table class names to avoid collision with prism highlighting 2023-11-26 21:45:55 -08:00
3da2c28b13 cleanup
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 20s
Build and test / build-and-test (20.x) (push) Successful in 20s
2023-08-19 16:07:37 -07:00
35a2080714 install
All checks were successful
Build and publish / build-and-publish (push) Successful in 21s
2023-08-19 16:06:52 -07:00
e99170f015 0.1.8
Some checks failed
Build and publish / build-and-publish (push) Failing after 11s
2023-08-19 16:04:40 -07:00
f48d0a6194 publish pipeline 2023-08-19 16:04:36 -07:00
92a9fe5685 fix base url issues 2023-08-19 16:04:07 -07:00
d0166b1db9 0.1.7
Some checks failed
Build and publish / build-and-publish (push) Failing after 10s
2023-08-19 15:39:27 -07:00
821456c226 publish 2023-08-19 15:39:24 -07:00
5ff9cee8de make base_url more optional 2023-08-19 15:38:54 -07:00
df4545a7f1 update package-lock.json
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 22s
Build and test / build-and-test (20.x) (push) Successful in 21s
2023-08-18 17:21:49 -07:00
34c4144c3d cleanup
Some checks failed
Build and test / build-and-test (18.x) (push) Failing after 11s
Build and test / build-and-test (20.x) (push) Failing after 19s
2023-08-18 17:20:51 -07:00
fbe142f12f only build on node 18+
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 20s
Build and test / build-and-test (20.x) (push) Successful in 19s
2023-08-18 17:09:21 -07:00
bcd60473b6 setup gitea actions
Some checks failed
Build and test / build-and-test (14.x) (push) Failing after 57s
Build and test / build-and-test (16.x) (push) Successful in 19s
Build and test / build-and-test (18.x) (push) Successful in 22s
Build and test / build-and-test (20.x) (push) Successful in 21s
2023-08-18 17:06:19 -07:00
46f7424bc9 more extra styles 2023-07-01 14:51:41 -07:00
dc3b8ea5d8 typography style updates; sort rss by publish date 2023-06-17 14:51:07 -07:00
12 changed files with 374 additions and 50 deletions

View File

@@ -0,0 +1,40 @@
name: Build and publish
on:
workflow_dispatch:
inputs:
version:
type: string
description: Semver to publish
required: true
jobs:
build-and-publish:
runs-on: ubuntu-latest
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Login to package registry
run: |
npm config set @doc-utils:registry https://gitea.jbrumond.me/api/packages/doc-utils/npm/
npm config set -- '//gitea.jbrumond.me/api/packages/doc-utils/npm/:_authToken' "$NPM_PUBLISH_TOKEN"
- name: Install dependencies
run: npm ci
- name: Compile TypeScript
run: npm run tsc
- name: Publish package
run: |
npm version ${{ inputs.version }} --allow-same-version --git-tag-version false
npm publish

View File

@@ -0,0 +1,40 @@
name: Build and test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Login to package registry
run: |
npm config set @doc-utils:registry https://gitea.jbrumond.me/api/packages/doc-utils/npm/
npm config set -- '//gitea.jbrumond.me/api/packages/doc-utils/npm/:_authToken' "$NPM_PUBLISH_TOKEN"
- name: Install dependencies
run: npm ci
- name: Compile TypeScript
run: npm run tsc
# todo: tests
- name: Run tests
run: exit 0

163
extras/figures.css Normal file
View File

@@ -0,0 +1,163 @@
figure[data-lang] {
margin-block: 2rem;
}
figure a.view-svg {
font-size: 0.85rem;
font-family: var(--font-body);
}
figure[data-lang] svg {
display: block;
margin-inline: auto;
margin-block: 2rem;
/* The auto-scaling font-size from typography/*.css does bad things to a lot of SVGs.
* The SVGs themselves are inherently scalable, so there is no need for it here anyway. */
font-size: 16px !important;
}
figure[data-size='medium']:has(svg) {
margin-block: 4rem;
}
figure[data-size='large'] {
margin-block: 6rem;
}
figure[data-size='small'] svg {
max-width: 40rem;
max-height: min(20rem, 50vw);
}
figure[data-size='medium'] svg {
max-width: 60rem;
max-height: min(40rem, 50vw);
}
figure[data-size='large'] svg {
max-height: min(60rem, 80vw);
}
/* figure[data-lang].big {
background: var(--theme-bg-main);
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1000;
display: flex;
border: 0.25rem var(--theme-line) solid;
margin: 3rem;
}
figure[data-lang].big svg {
max-width: none !important;
max-height: none !important;
} */
/* figure:is([data-lang='pikchr'], [data-lang='nomnoml'], [data-lang='bytefield']) svg text:not([fill^='var']) { */
figure:is([data-lang='pikchr'], [data-lang='nomnoml'], [data-lang='bytefield']) svg text {
fill: var(--theme-text-body);
}
figure:is([data-lang='pikchr'], [data-lang='nomnoml'], [data-lang='bytefield']) svg text:not([font-family~='Courier']) {
font-family: var(--font-body);
}
[data-lang='bash:samp'] samp {
display: block;
margin-block-start: 0.5rem;
padding-block-start: 0.5rem;
border-block-start: 0.1rem solid var(--theme-line);
}
/* === KaTeX === */
.katex-display {
color: var(--theme-text-body);
}
.katex-display .katex {
font-size: 1.4rem;
}
/* using "body" here to add specificity, to override styles from katex.min.css */
body .katex-display {
margin: 2rem;
}
body figure.align-left .katex-display > .katex {
text-align: left;
}
body figure.align-right .katex-display > .katex {
text-align: right;
}
:not(.katex-display) > .katex {
font-size: inherit;
margin-inline: 0.5rem;
}
.katex span[style~='color:transparent;'] {
user-select: none;
}
/* === Pikchr */
/* boxes */
figure[data-lang='pikchr'] svg path[style*='fill:none;'] {
fill: var(--theme-bg-light) !important;
transition: fill linear .5s;
}
/* lines and boxes */
figure[data-lang='pikchr'] svg path[style*='stroke:rgb(0,0,0);'] {
stroke: var(--theme-text-body) !important;
}
/* circles */
figure[data-lang='pikchr'] svg circle[style*='stroke:rgb(0,0,0);'] {
stroke: var(--theme-text-body) !important;
}
/* arrow heads */
figure[data-lang='pikchr'] svg polygon[style='fill:rgb(0,0,0)'] {
fill: var(--theme-text-body) !important;
transition: fill linear .5s;
}
/* === Bytefield === */
figure[data-lang='clojure:bytefield'] svg line[stroke-width='1'] {
stroke-width: 2;
}
figure[data-lang='clojure:bytefield'] svg :is(text, tspan)[font-size='11'] {
font-size: 14px;
}
figure[data-lang='clojure:bytefield'] svg :is(text, tspan)[font-size='18'] {
font-size: 16px;
}
figure[data-lang='clojure:bytefield'] svg :is(text, tspan)[font-family~='Courier'] {
font-family: var(--font-monospace);
}
figure[data-lang='clojure:bytefield'] svg :is(text, tspan)[font-family~='Times'] {
font-family: var(--font-body);
}
figure[data-lang='clojure:bytefield'] svg line[stroke-dasharray='1,1'] {
stroke-dasharray: 4px, 3px;
}
figure[data-lang='clojure:bytefield'] svg line[stroke-dasharray='1,3'] {
stroke-dasharray: 2px, 3px;
}

View File

@@ -76,3 +76,26 @@ dd + dt {
figcaption { figcaption {
margin-block-start: 1.5rem; margin-block-start: 1.5rem;
} }
/* ===== Pre-formatted Blocks ===== */
pre {
padding: 0.5rem;
margin-block: 1.5rem;
}
/* ===== Note Blocks ===== */
:is(aside, section):is([role='note'], .info, .highlight, .warning, .problem) > :first-child {
margin-block-start: 0.25rem;
}
:is(aside, section):is([role='note'], .info, .highlight, .warning, .problem) > :last-child {
margin-block-end: 0.25rem;
}

View File

@@ -80,13 +80,21 @@ p {
/* ===== Inline Styles ===== */
del {
text-decoration: line-through;
}
/* ===== Links ===== */ /* ===== Links ===== */
a { a {
font-family: inherit; font-family: inherit;
color: var(--theme-text-link); color: var(--theme-text-link);
display: inline-flex; display: inline;
align-items: center; align-items: center;
column-gap: 0.2rem; column-gap: 0.2rem;
} }
@@ -101,7 +109,8 @@ a:visited {
color: var(--theme-text-link-visited); color: var(--theme-text-link-visited);
} }
a.icon-link { a.icon-link,
a.inline-flex {
display: inline-flex; display: inline-flex;
column-gap: 0.3rem; column-gap: 0.3rem;
align-items: center; align-items: center;
@@ -111,6 +120,10 @@ a.icon-link svg.icon {
--icon-size: 1rem; --icon-size: 1rem;
} }
del a {
text-decoration: line-through underline;
}
@@ -180,64 +193,64 @@ mark {
/* ===== Tables ===== */ /* ===== Tables ===== */
table, .table, td, .td { table, .faux-table, td, .faux-td {
color: var(--theme-text-body); color: var(--theme-text-body);
font-family: var(--font-body); font-family: var(--font-body);
} }
table, .table { table, .faux-table {
display: table; display: table;
margin-block: 2rem; margin-block: 2rem;
border-collapse: collapse; border-collapse: collapse;
} }
table, th, td, table, th, td,
.table, .th, .td { .faux-table, .faux-th, .faux-td {
font-size: 1rem; font-size: 1rem;
line-height: 1.75; line-height: 1.75;
} }
thead, .thead { thead, .faux-thead {
display: table-header-group; display: table-header-group;
} }
tbody, .tbody { tbody, .faux-tbody {
display: table-row-group; display: table-row-group;
} }
tbody tr, tbody tr,
.tbody .tr { .faux-tbody .faux-tr {
border-top: 1px var(--theme-line) solid; border-top: 1px var(--theme-line) solid;
} }
tr, .tr { tr, .faux-tr {
display: table-row; display: table-row;
} }
th, .th { th, .faux-th {
text-align: center; text-align: center;
font-weight: 700; font-weight: 700;
color: var(--theme-text-heading); color: var(--theme-text-heading);
} }
th, .th, th, .faux-th,
td, .td { td, .faux-td {
padding-block: 0.5rem; padding-block: 0.5rem;
padding-inline: 1rem; padding-inline: 1rem;
display: table-cell; display: table-cell;
} }
td, .td { td, .faux-td {
display: table-cell; display: table-cell;
font-weight: 300; font-weight: 300;
vertical-align: top; vertical-align: top;
} }
:is(td, .td):not(:last-of-type) { :is(td, .faux-td):not(:last-of-type) {
border-inline-end: 0.1rem solid var(--theme-line); border-inline-end: 0.1rem solid var(--theme-line);
} }
:is(table, .table) :is(input, select) { :is(table, .faux-table) :is(input, select) {
margin-block: 0; margin-block: 0;
} }
@@ -255,24 +268,28 @@ table dl {
pre { pre {
color: var(--theme-code-normal); color: var(--theme-code-normal);
font-family: var(--font-monospace); font-family: var(--font-monospace);
margin-block: 3rem; margin-inline-start: 1rem;
margin-inline: 2rem; margin-inline-end: 5rem;
padding-block: 0.5rem;
padding-inline: 1rem;
border: 0.1rem solid var(--theme-line); border: 0.1rem solid var(--theme-line);
border-radius: 1rem; border-radius: 0.5rem;
font-size: 1rem; font-size: 1rem;
overflow: auto; overflow: auto;
background: var(--theme-bg-light); background: var(--theme-bg-light);
} }
@media screen and (max-width: 60rem) {
pre {
margin-inline: 0;
}
}
/* ===== Code / Sample Output ===== */ /* ===== Code / Sample Output ===== */
code, samp { code, samp {
font-size: 1rem; font-size: inherit;
color: var(--theme-code-normal); color: var(--theme-code-normal);
font-family: var(--font-monospace); font-family: var(--font-monospace);
} }
@@ -280,8 +297,11 @@ code, samp {
:not(pre) > :is(code, samp) { :not(pre) > :is(code, samp) {
color: inherit; color: inherit;
background: var(--theme-bg-light); background: var(--theme-bg-light);
margin-inline: 0.15rem;
padding-block: 0.1rem;
padding-inline: 0.25rem; padding-inline: 0.25rem;
border: 0.1rem solid var(--theme-line); border: 0.1rem solid var(--theme-line);
border-radius: 0.2rem;
} }

View File

@@ -45,6 +45,20 @@ p {
/* ===== Note Blocks ===== */
:is(aside, section):is([role='note'], .info, .highlight, .warning, .problem) > :first-child {
margin-block-start: 0.5rem;
}
:is(aside, section):is([role='note'], .info, .highlight, .warning, .problem) > :last-child {
margin-block-end: 0.5rem;
}
/* ===== Lists ===== */ /* ===== Lists ===== */
@@ -75,3 +89,13 @@ dd + dt {
figcaption { figcaption {
margin-block-start: 2rem; margin-block-start: 2rem;
} }
/* ===== Pre-formatted Blocks ===== */
pre {
margin-block: 2rem;
padding-block: 0.5rem;
padding-inline: 1rem;
}

35
package-lock.json generated
View File

@@ -1,16 +1,16 @@
{ {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.2.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.2.1",
"dependencies": { "dependencies": {
"@doc-utils/color-themes": "^0.1.14", "@doc-utils/color-themes": "^0.2.0",
"@doc-utils/jsonschema2markdown": "^0.1.1", "@doc-utils/jsonschema2markdown": "^0.1.1",
"@doc-utils/markdown2html": "^0.3.2", "@doc-utils/markdown2html": "^0.3.6",
"glob": "^10.2.3", "glob": "^10.2.3",
"ical": "^0.8.0", "ical": "^0.8.0",
"ical-generator": "^4.1.0", "ical-generator": "^4.1.0",
@@ -33,9 +33,9 @@
} }
}, },
"node_modules/@doc-utils/color-themes": { "node_modules/@doc-utils/color-themes": {
"version": "0.1.14", "version": "0.2.0",
"resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fcolor-themes/-/0.1.14/color-themes-0.1.14.tgz", "resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fcolor-themes/-/0.2.0/color-themes-0.2.0.tgz",
"integrity": "sha512-j0U8v8Y+9zAm9D7pbCheTQYGEKt9FSpKSZQNGsogxWl95S9Z7QMjtmJns6QPgdOsSDss7sjMLFS5Gm50GCMzNA==" "integrity": "sha512-UtjY25B8m4qdMvrmTPK3I1JXckbc1cvCOmIygHFBexpSWBQmb+sdoXfdCsoSpgPncurz1kwlEXffgPELCGtP8g=="
}, },
"node_modules/@doc-utils/jsonschema2markdown": { "node_modules/@doc-utils/jsonschema2markdown": {
"version": "0.1.1", "version": "0.1.1",
@@ -51,9 +51,9 @@
} }
}, },
"node_modules/@doc-utils/markdown2html": { "node_modules/@doc-utils/markdown2html": {
"version": "0.3.2", "version": "0.3.6",
"resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fmarkdown2html/-/0.3.2/markdown2html-0.3.2.tgz", "resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fmarkdown2html/-/0.3.6/markdown2html-0.3.6.tgz",
"integrity": "sha512-aRPlxA25gowmWmzPID4xyLCTVs7VgQJvlmYn3amnFAsUC55JzFXZQ9MR40AKeQYv9VSXIpxjUr7A86hgOzRFFw==", "integrity": "sha512-LCt5HAAcHz6lE+IqV2igQP7bbTq1juNbyn4KWqn3xe9eSslIyl7EvSaEH68WQtqEzX/iVFOvZz7qSoqsQeggXA==",
"dependencies": { "dependencies": {
"bytefield-svg": "^1.6.1", "bytefield-svg": "^1.6.1",
"dompurify": "^2.3.6", "dompurify": "^2.3.6",
@@ -66,6 +66,9 @@
"qrcode": "^1.5.1", "qrcode": "^1.5.1",
"vega": "^5.22.1", "vega": "^5.22.1",
"yaml": "^2.2.2" "yaml": "^2.2.2"
},
"bin": {
"markdown2html": "bin/markdown2html"
} }
}, },
"node_modules/@isaacs/cliui": { "node_modules/@isaacs/cliui": {
@@ -2674,9 +2677,9 @@
}, },
"dependencies": { "dependencies": {
"@doc-utils/color-themes": { "@doc-utils/color-themes": {
"version": "0.1.14", "version": "0.2.0",
"resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fcolor-themes/-/0.1.14/color-themes-0.1.14.tgz", "resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fcolor-themes/-/0.2.0/color-themes-0.2.0.tgz",
"integrity": "sha512-j0U8v8Y+9zAm9D7pbCheTQYGEKt9FSpKSZQNGsogxWl95S9Z7QMjtmJns6QPgdOsSDss7sjMLFS5Gm50GCMzNA==" "integrity": "sha512-UtjY25B8m4qdMvrmTPK3I1JXckbc1cvCOmIygHFBexpSWBQmb+sdoXfdCsoSpgPncurz1kwlEXffgPELCGtP8g=="
}, },
"@doc-utils/jsonschema2markdown": { "@doc-utils/jsonschema2markdown": {
"version": "0.1.1", "version": "0.1.1",
@@ -2692,9 +2695,9 @@
} }
}, },
"@doc-utils/markdown2html": { "@doc-utils/markdown2html": {
"version": "0.3.2", "version": "0.3.6",
"resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fmarkdown2html/-/0.3.2/markdown2html-0.3.2.tgz", "resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fmarkdown2html/-/0.3.6/markdown2html-0.3.6.tgz",
"integrity": "sha512-aRPlxA25gowmWmzPID4xyLCTVs7VgQJvlmYn3amnFAsUC55JzFXZQ9MR40AKeQYv9VSXIpxjUr7A86hgOzRFFw==", "integrity": "sha512-LCt5HAAcHz6lE+IqV2igQP7bbTq1juNbyn4KWqn3xe9eSslIyl7EvSaEH68WQtqEzX/iVFOvZz7qSoqsQeggXA==",
"requires": { "requires": {
"bytefield-svg": "^1.6.1", "bytefield-svg": "^1.6.1",
"dompurify": "^2.3.6", "dompurify": "^2.3.6",

View File

@@ -1,8 +1,8 @@
{ {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.2.1",
"publishConfig": { "publishConfig": {
"registry": "https://gitea.home.jbrumond.me/api/packages/doc-utils/npm/" "registry": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/"
}, },
"scripts": { "scripts": {
"tsc": "tsc", "tsc": "tsc",
@@ -22,9 +22,9 @@
"typescript": "^5.0.4" "typescript": "^5.0.4"
}, },
"dependencies": { "dependencies": {
"@doc-utils/color-themes": "^0.1.14", "@doc-utils/color-themes": "^0.2.0",
"@doc-utils/jsonschema2markdown": "^0.1.1", "@doc-utils/jsonschema2markdown": "^0.1.1",
"@doc-utils/markdown2html": "^0.3.2", "@doc-utils/markdown2html": "^0.3.6",
"glob": "^10.2.3", "glob": "^10.2.3",
"ical": "^0.8.0", "ical": "^0.8.0",
"ical-generator": "^4.1.0", "ical-generator": "^4.1.0",

View File

@@ -8,9 +8,8 @@ import { render_theme_css_properties } from '../themes';
import { load_partials, FrontMatter, Context, load_layout, render_template, EventFrontmatter } from '../template'; import { load_partials, FrontMatter, Context, load_layout, render_template, EventFrontmatter } from '../template';
import { render_markdown_to_html, render_markdown_to_html_inline_sync } from '@doc-utils/markdown2html'; import { render_markdown_to_html, render_markdown_to_html_inline_sync } from '@doc-utils/markdown2html';
import { RSSEntry } from './rss'; import { RSSEntry } from './rss';
import { DateTime } from 'luxon';
import { EventEntry } from './icalendar'; import { EventEntry } from './icalendar';
import { as_context_time, as_html_time, from_iso } from '../time'; import { as_context_time, from_iso } from '../time';
import { FileMetadata } from '../metadata'; import { FileMetadata } from '../metadata';
export interface OutFileURL { export interface OutFileURL {
@@ -31,9 +30,9 @@ export function map_output_file_to_url(state: BuildState, out_file: string, inde
rel_path = '/' + rel_path; rel_path = '/' + rel_path;
} }
const base_url = state.conf.base_url.endsWith('/') const base_url = state.conf.base_url?.endsWith('/')
? state.conf.base_url.slice(0, -1) ? state.conf.base_url.slice(0, -1)
: state.conf.base_url; : (state.conf.base_url ?? '');
return { return {
base_url, base_url,
@@ -108,7 +107,7 @@ export function mustache_context(state: BuildState, page_url: string, metadata:
return { return {
env: state.env, env: state.env,
page: frontmatter, page: frontmatter,
base_url: state.conf.base_url, base_url: state.conf.base_url ?? '/',
page_url: page_url, page_url: page_url,
page_published: as_context_time(from_iso(metadata.first_seen_time), 'dt-published'), page_published: as_context_time(from_iso(metadata.first_seen_time), 'dt-published'),
page_updated: has_been_updated ? as_context_time(from_iso(metadata.last_updated_time), 'dt-updated') : null, page_updated: has_been_updated ? as_context_time(from_iso(metadata.last_updated_time), 'dt-updated') : null,
@@ -142,7 +141,7 @@ export function mustache_context(state: BuildState, page_url: string, metadata:
export async function render_page(state: BuildState, in_file: string, out_file: string, out_url: OutFileURL, text: string, render_as_markdown: boolean, hash: string, frontmatter?: any) { export async function render_page(state: BuildState, in_file: string, out_file: string, out_url: OutFileURL, text: string, render_as_markdown: boolean, hash: string, frontmatter?: any) {
if (render_as_markdown) { if (render_as_markdown) {
const opts = Object.assign({ }, state.conf.markdown, { const opts = Object.assign({ }, state.conf.markdown, {
base_url: out_url.abs_url // base_url: out_url.abs_url,
}); });
text = await render_markdown_to_html(text, opts); text = await render_markdown_to_html(text, opts);

View File

@@ -34,7 +34,7 @@ export async function render_markdown_file(state: BuildState, in_file: string) {
const out_file = await map_input_file_to_output_file(state, in_file, [ '.md', '.markdown' ], '.html'); const out_file = await map_input_file_to_output_file(state, in_file, [ '.md', '.markdown' ], '.html');
const out_url = map_output_file_to_url(state, out_file); const out_url = map_output_file_to_url(state, out_file);
const { frontmatter, text, hash } = await read_text(in_file); const { frontmatter, text, hash } = await read_text(in_file);
if (frontmatter?.skip) { if (frontmatter?.skip) {
return; return;
} }

View File

@@ -6,6 +6,7 @@ import { write_text } from '../fs';
import { AuthorConfig, app_version } from '../conf'; import { AuthorConfig, app_version } from '../conf';
import { map_output_file_to_url } from './helpers'; import { map_output_file_to_url } from './helpers';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import { FileMetadata } from '../metadata';
export interface RSSEntry { export interface RSSEntry {
url: string; url: string;
@@ -84,11 +85,21 @@ export async function write_rss_if_needed(state: BuildState) {
// channel.ele('image').txt(''); // channel.ele('image').txt('');
// channel.ele('skipHours').txt(''); // channel.ele('skipHours').txt('');
// channel.ele('skipDays').txt(''); // channel.ele('skipDays').txt('');
let entries: (RSSEntry & { metadata: FileMetadata, first_seen: number })[] = [ ];
for (const entry of state.rss[index] || [ ]) { for (const entry of state.rss[index] || [ ]) {
const item = channel.ele('item');
const in_file = entry.in_file.slice(state.conf.input.root.length); const in_file = entry.in_file.slice(state.conf.input.root.length);
const metadata = state.new_metadata.files[in_file]; const metadata = state.new_metadata.files[in_file];
entries.push({ ...entry, metadata, first_seen: DateTime.fromISO(metadata.first_seen_time).toUnixInteger() });
}
entries = entries.sort((a, b) => {
return b.first_seen - a.first_seen;
});
for (const entry of entries) {
const item = channel.ele('item');
item.ele('link').txt(entry.url); item.ele('link').txt(entry.url);
@@ -111,7 +122,7 @@ export async function write_rss_if_needed(state: BuildState) {
} }
item.ele('guid').txt(entry.url); item.ele('guid').txt(entry.url);
item.ele('pubDate').txt(DateTime.fromISO(metadata.first_seen_time).toRFC2822()); item.ele('pubDate').txt(DateTime.fromISO(entry.metadata.first_seen_time).toRFC2822());
if (entry.html_content) { if (entry.html_content) {
item.ele('content:encoded').ele({ $: entry.html_content }); item.ele('content:encoded').ele({ $: entry.html_content });

View File

@@ -116,6 +116,7 @@ export async function load_extras() {
'forms-inputs/spacious.css', 'forms-inputs/spacious.css',
'forms-inputs/compact.css', 'forms-inputs/compact.css',
'forms-inputs/general.css', 'forms-inputs/general.css',
'figures.css',
]; ];
const promises = extras_files.map((file) => load_from_dir(extras_dir, file)); const promises = extras_files.map((file) => load_from_dir(extras_dir, file));