git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
73efa77
)
word/finder: common method to format caption names
author
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 6 Jun 2022 17:00:35 +0000
(19:00 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 11 Jul 2022 02:02:34 +0000
(
04:02
+0200)
word/finder.js
patch
|
blob
|
history
diff --git
a/word/finder.js
b/word/finder.js
index 5dcc9e3de93f079521c4be441f0345795ce99c78..9f56a2c28c553ff7f5690278c46ec6cc0937ae71 100644
(file)
--- a/
word/finder.js
+++ b/
word/finder.js
@@
-1,4
+1,15
@@
class WordFinder extends WordQuiz {
class WordFinder extends WordQuiz {
+ namehtml(name) {
+ //let wbr = new RegExp('\w{4} [^aoeuiyc\W] [rl]?+ \K (?= [^aoeuiy\W] [rl]? [aoeuiy] \w)', 'g');
+ let aliases = name.split('/');
+ let html = aliases.shift();
+ html = html.replace(/\((.+)\)/, '<small>$1</small>');
+ for (let alias of aliases) {
+ html += ` <small>(${alias})</small>`;
+ }
+ return html;
+ }
+
add(catitem, rows) {
rows.forEach(ref => {
const [title, level, imgid, subs] = this.data[ref];
add(catitem, rows) {
rows.forEach(ref => {
const [title, level, imgid, subs] = this.data[ref];
@@
-8,9
+19,8
@@
class WordFinder extends WordQuiz {
put(figitem, 'img[src=$]', `/data/word/32/${imgid}.jpg`);
}
if (title) {
put(figitem, 'img[src=$]', `/data/word/32/${imgid}.jpg`);
}
if (title) {
- let html = title.replace(/\/(.*)/, ' <small>($1)</small>');
put(figitem, 'figcaption', {
put(figitem, 'figcaption', {
- innerHTML:
html
,
+ innerHTML:
this.namehtml(title)
,
});
}
if (level <= 1 && subs.length >= 2) {
});
}
if (level <= 1 && subs.length >= 2) {