6 Commits

Author SHA1 Message Date
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
6 changed files with 24 additions and 22 deletions

View File

@@ -2,7 +2,10 @@
name: Build and publish name: Build and publish
on: on:
- workflow_dispatch # - workflow_dispatch
push:
branches:
- master
jobs: jobs:
build-and-publish: build-and-publish:

View File

@@ -2,9 +2,9 @@
name: Build and test name: Build and test
on: on:
push: # push:
branches: # branches:
- master # - master
pull_request: pull_request:
branches: branches:
- master - master

18
package-lock.json generated
View File

@@ -1,16 +1,16 @@
{ {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.1.8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.1.8",
"dependencies": { "dependencies": {
"@doc-utils/color-themes": "^0.2.0", "@doc-utils/color-themes": "^0.2.0",
"@doc-utils/jsonschema2markdown": "^0.1.1", "@doc-utils/jsonschema2markdown": "^0.1.1",
"@doc-utils/markdown2html": "^0.3.4", "@doc-utils/markdown2html": "^0.3.5",
"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",
@@ -51,9 +51,9 @@
} }
}, },
"node_modules/@doc-utils/markdown2html": { "node_modules/@doc-utils/markdown2html": {
"version": "0.3.4", "version": "0.3.5",
"resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fmarkdown2html/-/0.3.4/markdown2html-0.3.4.tgz", "resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fmarkdown2html/-/0.3.5/markdown2html-0.3.5.tgz",
"integrity": "sha512-zL3kay/zbrBJWGKIxGCyF+EXsafSxY1aN+miG+GOyml1neoOwd67vNIiE96KuEucf6rvuICPiYTjm3uJxkjd/g==", "integrity": "sha512-Z5zeHIRU7gyMu8taiNcQ2+FYD08184FGNzKBT2y4mtYTjSRBlFQH+trye6e14Mzc1wx9juoZ7KpysS1M6qe4sw==",
"dependencies": { "dependencies": {
"bytefield-svg": "^1.6.1", "bytefield-svg": "^1.6.1",
"dompurify": "^2.3.6", "dompurify": "^2.3.6",
@@ -2695,9 +2695,9 @@
} }
}, },
"@doc-utils/markdown2html": { "@doc-utils/markdown2html": {
"version": "0.3.4", "version": "0.3.5",
"resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fmarkdown2html/-/0.3.4/markdown2html-0.3.4.tgz", "resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fmarkdown2html/-/0.3.5/markdown2html-0.3.5.tgz",
"integrity": "sha512-zL3kay/zbrBJWGKIxGCyF+EXsafSxY1aN+miG+GOyml1neoOwd67vNIiE96KuEucf6rvuICPiYTjm3uJxkjd/g==", "integrity": "sha512-Z5zeHIRU7gyMu8taiNcQ2+FYD08184FGNzKBT2y4mtYTjSRBlFQH+trye6e14Mzc1wx9juoZ7KpysS1M6qe4sw==",
"requires": { "requires": {
"bytefield-svg": "^1.6.1", "bytefield-svg": "^1.6.1",
"dompurify": "^2.3.6", "dompurify": "^2.3.6",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.1.8",
"publishConfig": { "publishConfig": {
"registry": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/" "registry": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/"
}, },
@@ -24,7 +24,7 @@
"dependencies": { "dependencies": {
"@doc-utils/color-themes": "^0.2.0", "@doc-utils/color-themes": "^0.2.0",
"@doc-utils/jsonschema2markdown": "^0.1.1", "@doc-utils/jsonschema2markdown": "^0.1.1",
"@doc-utils/markdown2html": "^0.3.4", "@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;
} }