-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web app): finalize content-loading algorithm
- finalized the Table of Contents generation algorithm - converted all content to JSON (text is now stored directly in the Catechism structure, instead of a separate file) - made PathID more meaningful - added a `semanticPath` property to all content items - URLs now use the more readable semantic path - improved typings and code organization
- Loading branch information
1 parent
7cd2b59
commit 4b6d2dd
Showing
106 changed files
with
467,613 additions
and
99,161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": "." | ||
} | ||
], | ||
"settings": { | ||
"deno.enable": true | ||
} | ||
"folders": [ | ||
{ | ||
"path": "." | ||
} | ||
], | ||
"settings": { | ||
"deno.enable": true, | ||
"deno.lint": true, | ||
"deno.unstable": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# The Catechism of the Catholic Church | ||
|
||
This contains the Catechism of the Catholic Church in an arrangement that decouples its structure, text, and visual | ||
This contains the Catechism of the Catholic Church in an arrangement that decouples its content and visual | ||
representation as much as possible. All information necessary for a visual rendering of the content is provided. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
import { build as buildPathMap } from './path-map.ts'; | ||
import Catechism from '../content/catechism.json' assert { type: 'json' }; | ||
import { CatechismStructure } from '../source/types/types.ts'; | ||
|
||
import { build as buildContentMap } from './path-id-to-content-map.ts'; | ||
import { build as buildSemanticMap } from './semantic-path-to-renderable-path-id-map.ts'; | ||
import { build as buildTableOfContents } from './table-of-contents.ts'; | ||
import { Catechism } from '../source/catechism.ts'; | ||
import { PathMap, TableOfContentsType } from '../source/types/types.ts'; | ||
import { PathIdContentMap, SemanticPathPathIdMap, TableOfContentsType } from '../source/types/types.ts'; | ||
|
||
buildArtifacts(); | ||
|
||
function buildArtifacts(): void { | ||
console.log('\nBuilding artifacts ...'); | ||
|
||
console.log('\ttable-of-contents ...'); | ||
const tableOfContents = buildTableOfContents(Catechism); | ||
console.log('\ttable of contents ...'); | ||
const catechism = Catechism as CatechismStructure; | ||
const tableOfContents = buildTableOfContents(catechism); | ||
writeJson(tableOfContents, 'table-of-contents'); | ||
|
||
console.log('\tsemantic-path to path-id map ...'); | ||
const pathMap = buildPathMap(tableOfContents); | ||
writeJson(pathMap, 'semantic-path-to-path-id'); | ||
console.log('\tSemanticPath to PathID map ...'); | ||
const renderablePathMap = buildSemanticMap(tableOfContents); | ||
writeJson(renderablePathMap, 'semantic-path_to_renderable-path-id'); | ||
|
||
console.log('\tPathID to renderable PathID map ...'); | ||
const contentMap = buildContentMap(renderablePathMap, catechism); | ||
writeJson(contentMap, 'renderable-path-id_to_content'); | ||
} | ||
|
||
function writeJson(object: PathMap | TableOfContentsType, filename: string): void { | ||
function writeJson(object: PathIdContentMap | SemanticPathPathIdMap | TableOfContentsType, filename: string): void { | ||
Deno.writeTextFileSync( | ||
`catechism/artifacts/${filename}.json`, | ||
JSON.stringify(object, undefined, ' ') + '\n', | ||
JSON.stringify(object, undefined, ' ') + '\n', | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { CatechismStructure, PathIdContentMap, SemanticPathPathIdMap } from '../source/types/types.ts'; | ||
import { getContentForRendering } from '../../web-utils/rendering.ts'; | ||
|
||
export function build(renderablePathMap: SemanticPathPathIdMap, catechism: CatechismStructure): PathIdContentMap { | ||
const contentMap: PathIdContentMap = {}; | ||
|
||
const pathIDs = Object.values(renderablePathMap); | ||
for (const originalPathID of pathIDs) { | ||
const content = getContentForRendering(originalPathID, catechism); | ||
|
||
if (!contentMap[originalPathID]) { | ||
contentMap[originalPathID] = content; | ||
} | ||
} | ||
|
||
return contentMap; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.