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