Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions js/crsearch/kunai-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@ class ArticleProcessor {
this._zoneProc = new Map([
[
Prop.toplevel_category, {
/* Token handlers for Marked >= v1.0.0 */
'list': list => {
for (const item of list.get('items')) {
if (item.type !== 'list_item') continue

let buf = ''
for (const token of item.tokens) {
if (token.type === 'text')
buf += token.text
}

const m = buf.match(/^([^[]+)\[([^\]]+)\]$/)
if (!m) {
throw new Error(`[BUG] unhandled format ${buf}`)
}

this._categories.set(
m[2],
new Priority(
this._currentIndex++, m[1]
)
)
}
},

/* Token handlers for Marked < v1.0.0 */
'list_item_start': () => {
this._single_bufs.push('')
},
Expand All @@ -67,8 +93,8 @@ class ArticleProcessor {
)
},
'text': token => {
// console.log(token)
this._single_bufs[this._single_bufs.length - 1] += token.get('text').trim()
if (this._single_bufs.length > 0)
this._single_bufs[this._single_bufs.length - 1] += token.get('text').trim()
},
}
],
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crsearch",
"version": "3.0.23",
"version": "3.0.24",
"description": "cpprefjp / boostjp searcher",
"main": "dist/js/crsearch.js",
"module": "js/crsearch.js",
Expand Down
Loading