mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +00:00
Merge branch 'Extended_DD' of github.com:dbolacksn/homebrewery-broken into Extended_DD
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
"test:mustache-syntax:inline": "jest '.*(mustache-syntax).*' -t '^Inline:.*' --verbose --noStackTrace",
|
||||
"test:mustache-syntax:block": "jest '.*(mustache-syntax).*' -t '^Block:.*' --verbose --noStackTrace",
|
||||
"test:mustache-syntax:injection": "jest '.*(mustache-syntax).*' -t '^Injection:.*' --verbose --noStackTrace",
|
||||
"test:marked-extensions": "jest '.*(marked-extensions).*' --verbose --noStackTrace",
|
||||
"test:marked-extensions": "jest tests/markdown/marked-extensions.test.js --verbose --noStackTrace",
|
||||
"test:route": "jest tests/routes/static-pages.test.js --verbose",
|
||||
"phb": "node scripts/phb.js",
|
||||
"prod": "set NODE_ENV=production && npm run build",
|
||||
|
||||
@@ -401,12 +401,12 @@ const definitionLists = {
|
||||
}
|
||||
},
|
||||
renderer(token) {
|
||||
let returnVal = `<dl${token.inlineDefinitions ? ' class="inlineDL"' : ''}>`;
|
||||
let returnVal = `<dl>`;
|
||||
token.definitions.forEach((def)=>{
|
||||
let dds = def.ddo.map((s)=>{
|
||||
return `<dd>${this.parser.parseInline(s).trim()}</dd>`;
|
||||
}).join('\n');
|
||||
returnVal += `<dt>${this.parser.parseInline(def.dt)}</dt>${dds.indexOf('\n') > -1 ? '\n' : ''}${dds}\n`;
|
||||
return `${token.inlineDefinitions ? '' : '\n'}<dd>${this.parser.parseInline(s).trim()}</dd>`;
|
||||
}).join('');
|
||||
returnVal += `<dt>${this.parser.parseInline(def.dt)}</dt>${dds}\n`;
|
||||
});
|
||||
returnVal = returnVal.trim();
|
||||
return `${returnVal}</dl>`;
|
||||
|
||||
@@ -2,55 +2,60 @@
|
||||
|
||||
const Markdown = require('naturalcrit/markdown.js');
|
||||
|
||||
describe('Dictionary Terms', ()=>{
|
||||
test('Single Definition', function() {
|
||||
describe('Inline Definition Lists', ()=>{
|
||||
test('Single Definition Term', function() {
|
||||
const source = 'My term :: My First Definition\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl class="inlineDL"><dt>My term</dt><dd>My First Definition</dd></dl>');
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>My term</dt><dd>My First Definition</dd></dl>');
|
||||
});
|
||||
|
||||
test('Multiple Definition Terms, single line, single definition', function() {
|
||||
test('Multiple Definition Terms', function() {
|
||||
const source = 'Term 1::Definition of Term 1\nTerm 2::Definition of Term 2\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl class="inlineDL"><dt>Term 1</dt><dd>Definition of Term 1</dd>\n<dt>Term 2</dt><dd>Definition of Term 2</dd></dl>');
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt><dd>Definition of Term 1</dd>\n<dt>Term 2</dt><dd>Definition of Term 2</dd></dl>');
|
||||
});
|
||||
});
|
||||
|
||||
test('PANdoc style list - Single Term, Single Definition', function() {
|
||||
describe('Multiline Definition Lists', ()=>{
|
||||
test('Single Term, Single Definition', function() {
|
||||
const source = 'Term 1\n::Definition 1\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt><dd>Definition 1</dd></dl>');
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt>\n<dd>Definition 1</dd></dl>');
|
||||
});
|
||||
|
||||
test('PANdoc style list - Single Term, Plural Definitions', function() {
|
||||
test('Single Term, Plural Definitions', function() {
|
||||
const source = 'Term 1\n::Definition 1\n::Definition 2\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt>\n<dd>Definition 1</dd>\n<dd>Definition 2</dd></dl>');
|
||||
});
|
||||
|
||||
test('PANdoc style list - Multiple Term, Single Definitions', function() {
|
||||
const source = 'Term 1\n::Definition 1\nTerm 2\n::Definition 1\n\n';
|
||||
test('Multiple Term, Single Definitions', function() {
|
||||
const source = 'Term 1\n::Definition 1\n\nTerm 2\n::Definition 1\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt><dd>Definition 1</dd>\n<dt>Term 2</dt><dd>Definition 1</dd></dl>');
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt>\n<dd>Definition 1</dd>\n<dt>Term 2</dt>\n<dd>Definition 1</dd></dl>');
|
||||
});
|
||||
|
||||
test('PANdoc style list - Multiple Term, Plural Definitions', function() {
|
||||
const source = 'Term 1\n::Definition 1\n::Definition 2\nTerm 2\n::Definition 1\n::Definition 2\n\n';
|
||||
test('Multiple Term, Plural Definitions', function() {
|
||||
const source = 'Term 1\n::Definition 1\n::Definition 2\n\nTerm 2\n::Definition 1\n::Definition 2\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt>\n<dd>Definition 1</dd>\n<dd>Definition 2</dd>\n<dt>Term 2</dt>\n<dd>Definition 1</dd>\n<dd>Definition 2</dd></dl>');
|
||||
});
|
||||
|
||||
test('PANdoc style list - Single Term, Single multiple line definition', function() {
|
||||
test('Single Term, Single multi-line definition', function() {
|
||||
const source = 'Term 1\n::Definition 1\nand more and\nmore and more\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt><dd>Definition 1 and more and more and more</dd></dl>');
|
||||
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt>\n<dd>Definition 1 and more and more and more</dd></dl>');
|
||||
});
|
||||
|
||||
test('PANdoc style list - Multiple Term, Single multiple line definition', function() {
|
||||
const source = 'Term 1\n::Definition 1\nand more and\nmore and more\n\n::Definition 2\n\n::Definition 3\n\n';
|
||||
test('Single Term, Plural multi-line definitions', function() {
|
||||
const source = 'Term 1\n::Definition 1\nand more and more\n::Definition 2\n\n::Definition 3\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt>\n<dd>Definition 1 and more and more and more</dd>\n<dd>Definition 2</dd>\n<dd>Definition 3</dd></dl>');
|
||||
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt>\n<dd>Definition 1 and more and more</dd>\n<dd>Definition 2</dd>\n<dd>Definition 3</dd></dl>');
|
||||
});
|
||||
|
||||
test('Multiple Term, Single multi-line definition', function() {
|
||||
const source = 'Term 1\n::Definition 1\nand more and more\n\nTerm 2\n::Definition 1\n\n::Definition 2\n\n';
|
||||
const rendered = Markdown.render(source);
|
||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt>\n<dd>Definition 1 and more and more</dd>\n<dt>Term 2</dt>\n<dd>Definition 1</dd>\n<dd>Definition 2</dd></dl>');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -319,30 +319,6 @@
|
||||
padding : 0px;
|
||||
margin-bottom : 0.325cm;
|
||||
|
||||
dl {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
dt::before {
|
||||
display: block;
|
||||
}
|
||||
|
||||
dt:nth-child(1n+2)::before {
|
||||
content: "";
|
||||
display: block;
|
||||
}
|
||||
|
||||
dt {
|
||||
display: inline;
|
||||
margin-right : 5px;
|
||||
margin-left : 0em;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
dd {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
//Headers
|
||||
h2 {
|
||||
margin : 0;
|
||||
@@ -886,36 +862,14 @@
|
||||
dl {
|
||||
line-height : 1.25em;
|
||||
& + * { margin-top : 0.17cm; }
|
||||
white-space: normal !important;
|
||||
|
||||
}
|
||||
|
||||
dd {
|
||||
display: block
|
||||
}
|
||||
|
||||
p + dl { margin-top : 0.17cm; }
|
||||
|
||||
dt {
|
||||
display : inline;
|
||||
dt {
|
||||
margin-right : 5px;
|
||||
margin-left : -1em;
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************
|
||||
// * Inline Definition Lists
|
||||
// *****************************/
|
||||
.inlineDL dd {
|
||||
display: inline !important
|
||||
}
|
||||
|
||||
.inlineDL dd:after{
|
||||
display: block;
|
||||
content: '';
|
||||
}
|
||||
|
||||
|
||||
// *****************************
|
||||
// * WIDE
|
||||
// *****************************/
|
||||
|
||||
Reference in New Issue
Block a user