bahai-indexes
Advanced tools
Comparing version 0.11.0 to 0.12.0
# CHANGES to `bahai-indexes` | ||
## 0.12.0 | ||
- feat: adds SAQ index | ||
- fix: bug with entry clicks | ||
## 0.11.0 | ||
@@ -4,0 +9,0 @@ |
@@ -22,3 +22,35 @@ /** | ||
switch (book) { | ||
case 'Gleanings': | ||
case 'Some Answered Questions': { | ||
// There are also Roman numeral links to detect, but our online | ||
// copy doesn't have those page anchors apparently | ||
// CHAPTER+PARAGRAPH | ||
let {groups: {num, par}} = linkText.match( | ||
/^(?<num>\d+)\.(?<par>\d+)$/u | ||
) || {groups: {}}; | ||
if (num) { | ||
a.href = 'https://bahai-library.com/abdul-baha_some_answered_questions#par' + | ||
num + '-' + par; | ||
} else { | ||
// CHAPTER ONLY | ||
({groups: {num}} = linkText.match( | ||
/^(?<num>\d+)$/u | ||
) || {groups: {}}); | ||
if (num) { | ||
a.href = 'https://bahai-library.com/abdul-baha_some_answered_questions#chapter' + | ||
num; | ||
} else { | ||
// FOOTNOTE | ||
const {groups: {footnote}} = linkText.match( | ||
/^(?<num>\d+)\.(?<par>\d+)n(?<footnote>\d+)$/u | ||
) || {groups: {}}; | ||
if (footnote) { | ||
a.href = 'https://bahai-library.com/abdul-baha_some_answered_questions#endnote-body-' + | ||
footnote; | ||
} | ||
} | ||
} | ||
break; | ||
} case 'Gleanings': | ||
a.href = 'https://bahai-library.com/writings/bahaullah/' + | ||
@@ -25,0 +57,0 @@ 'gwb/gleaningsall.html#' + number; |
@@ -48,7 +48,5 @@ import {$, $$, httpquery, populateFullIndex} from './utils.js'; | ||
if (e.manuallyTriggered !== false) { | ||
const params = new URLSearchParams(location.search); | ||
params.set('entry', ev.target.dataset.id); | ||
history.pushState(null, null, '?' + params.toString()); | ||
} | ||
const params = new URLSearchParams(location.search); | ||
params.set('entry', ev.target.dataset.id); | ||
history.pushState(null, null, '?' + params.toString()); | ||
@@ -126,3 +124,5 @@ targetedEntry.scrollIntoView(); | ||
searchEntriesForm.addEventListener('submit', searchEntriesFormSubmit); | ||
searchEntriesPagesForm.addEventListener('submit', searchEntriesPagesFormSubmit); | ||
searchEntriesPagesForm.addEventListener( | ||
'submit', searchEntriesPagesFormSubmit | ||
); | ||
@@ -129,0 +129,0 @@ const storeInput = (id) => { |
@@ -65,5 +65,11 @@ /* eslint-disable no-unsanitized/property -- Source must be trusted as | ||
function populateFullIndex ({result, ul, id, entriesOrLinks = 'both'}) { | ||
traverse(result, ul, (obj, parent) => { | ||
traverse(result, ul, (obj, parent, paths) => { | ||
const li = document.createElement('li'); | ||
li.id = id; | ||
const currentId = id === obj.$text | ||
? id | ||
: `${paths.join(', ')}, ${obj.$text}`; | ||
li.id = currentId; | ||
paths.push(obj.$text); | ||
li.innerHTML = obj.$text; | ||
@@ -70,0 +76,0 @@ const links = obj.$links || []; |
{ | ||
"name": "bahai-indexes", | ||
"type": "module", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "Indexes to the Bahá'í Writings in JSON form", | ||
"main": "src/buildFlattenedJSONAndJS.js", | ||
"scripts": { | ||
"addBook": "node indexes/addBook.js", | ||
"start": "httpquery --path=indexes/json --debug", | ||
"eslint": "eslint --ext=js,md,html .", | ||
"lint": "npm run eslint --", | ||
"build-books": "node indexes/books.js", | ||
"build": "node src/buildFlattenedJSONAndJS.js", | ||
"parse": "npm run parse-aqdas", | ||
"parse-aqdas": "node parsers/html/aqdas.js", | ||
"parse-iqan": "node parsers/html/iqan.js", | ||
"test": "npm run eslint && echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
@@ -61,3 +49,16 @@ "type": "git", | ||
"jsdom": "^22.1.0" | ||
}, | ||
"scripts": { | ||
"addBook": "node indexes/addBook.js", | ||
"start": "httpquery --path=indexes/json --debug", | ||
"eslint": "eslint --ext=js,md,html .", | ||
"lint": "npm run eslint --", | ||
"build-books": "node indexes/books.js", | ||
"build": "node src/buildFlattenedJSONAndJS.js", | ||
"parse": "npm run parse-aqdas", | ||
"parse-aqdas": "node parsers/html/aqdas.js", | ||
"parse-saq": "node parsers/html/saq.js", | ||
"parse-iqan": "node parsers/html/iqan.js", | ||
"test": "npm run eslint && echo \"Error: no test specified\" && exit 1" | ||
} | ||
} | ||
} |
@@ -27,2 +27,4 @@ # bahai-indexes | ||
- *Some Answered Questions* - From <https://bahai-library.com/zamir/indexes/Some%20Answered%20Questions%20(2015)%20%20INDEX%20copy.html>. | ||
## Higher priority to-dos | ||
@@ -29,0 +31,0 @@ |
@@ -59,10 +59,7 @@ // Todo: It would be ideal if this could be made generic to other books, but | ||
* A range of pages/paragraphs/verses. | ||
* @typedef {GenericArray} LinksMetaArray | ||
* @property {string} 0 | ||
* @property {string} 1 | ||
* @typedef {[string, string]} LinksMetaArray | ||
*/ | ||
/** | ||
* @typedef {GenericArray} LinksMeta | ||
* @property {string|LinksMetaArray} * | ||
* @typedef {(string|LinksMetaArray)[]} LinksMeta | ||
*/ | ||
@@ -69,0 +66,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3606026
33
144485
57