@kenjura/ursa 0.46.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.47.0
2
+ 2025-12-20
3
+
4
+ - Improved handling of trailing slashes in URLs to ensure consistency across all links and resources
5
+
1
6
  # 0.46.0
2
7
  2025-12-20
3
8
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@kenjura/ursa",
3
3
  "author": "Andrew London <andrew@kenjura.com>",
4
4
  "type": "module",
5
- "version": "0.46.0",
5
+ "version": "0.47.0",
6
6
  "description": "static site generator from MD/wikitext/YML",
7
7
  "main": "lib/index.js",
8
8
  "bin": {
@@ -578,7 +578,7 @@ export async function generate({
578
578
 
579
579
  // Automatic index generation for folders without index.html
580
580
  progress.log(`Checking for missing index files...`);
581
- await generateAutoIndices(output, allSourceFilenamesThatAreDirectories, source, templates, menu, footer);
581
+ await generateAutoIndices(output, allSourceFilenamesThatAreDirectories, source, templates, menu, footer, allSourceFilenamesThatAreArticles);
582
582
 
583
583
  // Save the hash cache to .ursa folder in source directory
584
584
  if (hashCache.size > 0) {
@@ -631,7 +631,7 @@ export async function generate({
631
631
  * @param {string} menu - Rendered menu HTML
632
632
  * @param {string} footer - Footer HTML
633
633
  */
634
- async function generateAutoIndices(output, directories, source, templates, menu, footer) {
634
+ async function generateAutoIndices(output, directories, source, templates, menu, footer, generatedArticles) {
635
635
  // Alternate index file names to look for (in priority order)
636
636
  const INDEX_ALTERNATES = ['_index.html', 'home.html', '_home.html'];
637
637
 
@@ -639,6 +639,17 @@ async function generateAutoIndices(output, directories, source, templates, menu,
639
639
  const sourceNorm = source.replace(/\/+$/, '');
640
640
  const outputNorm = output.replace(/\/+$/, '');
641
641
 
642
+ // Build set of directories that already have an index.html from a source index.md/txt/yml
643
+ const dirsWithSourceIndex = new Set();
644
+ for (const articlePath of generatedArticles) {
645
+ const base = basename(articlePath, extname(articlePath));
646
+ if (base === 'index') {
647
+ const dir = dirname(articlePath);
648
+ const outputDir = dir.replace(sourceNorm, outputNorm);
649
+ dirsWithSourceIndex.add(outputDir);
650
+ }
651
+ }
652
+
642
653
  // Get all output directories (including root)
643
654
  const outputDirs = new Set([outputNorm]);
644
655
  for (const dir of directories) {
@@ -653,7 +664,12 @@ async function generateAutoIndices(output, directories, source, templates, menu,
653
664
  for (const dir of outputDirs) {
654
665
  const indexPath = join(dir, 'index.html');
655
666
 
656
- // Skip if index.html already exists
667
+ // Skip if this directory had a source index.md/txt/yml that was already processed
668
+ if (dirsWithSourceIndex.has(dir)) {
669
+ continue;
670
+ }
671
+
672
+ // Skip if index.html already exists (e.g., created by previous run)
657
673
  if (existsSync(indexPath)) {
658
674
  continue;
659
675
  }