mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 20:12:41 +00:00
Add Multi-line Dictionary Definition (<dd>) rows.
Expands the existing syntax to allow/expect the option of multiple definitions by adding any number of ``` :: Definition``` to an a DT/DD set.
This commit is contained in:
@@ -218,8 +218,9 @@ const definitionLists = {
|
|||||||
while (match = regex.exec(src)) {
|
while (match = regex.exec(src)) {
|
||||||
definitions.push({
|
definitions.push({
|
||||||
dt : this.lexer.inlineTokens(match[1].trim()),
|
dt : this.lexer.inlineTokens(match[1].trim()),
|
||||||
dd : this.lexer.inlineTokens(match[2].trim())
|
dd : match[2].split('::').map((s)=>this.lexer.inlineTokens(s.trim()))
|
||||||
});
|
});
|
||||||
|
console.log(match.splice(2).map((s)=>s.trim()));
|
||||||
endIndex = regex.lastIndex;
|
endIndex = regex.lastIndex;
|
||||||
}
|
}
|
||||||
if(definitions.length) {
|
if(definitions.length) {
|
||||||
@@ -232,8 +233,9 @@ const definitionLists = {
|
|||||||
},
|
},
|
||||||
renderer(token) {
|
renderer(token) {
|
||||||
return `<dl>${token.definitions.reduce((html, def)=>{
|
return `<dl>${token.definitions.reduce((html, def)=>{
|
||||||
return `${html}<dt>${this.parser.parseInline(def.dt)}</dt>`
|
const dds = def.dd.map((s)=>`<dd>${this.parser.parseInline(s)}</dd>`).join('\n');
|
||||||
+ `<dd>${this.parser.parseInline(def.dd)}</dd>\n`;
|
return `${html}<dt>${this.parser.parseInline(def.dt)}</dt>
|
||||||
|
${dds}`;
|
||||||
}, '')}</dl>`;
|
}, '')}</dl>`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user