0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-13 04:22:40 +00:00

Renaming colors and a bunch of other things

This commit is contained in:
Scott Tolksdorf
2017-06-04 16:04:34 -04:00
parent 705adbe2c6
commit 10f9ac14c7
11 changed files with 35 additions and 31 deletions

View File

@@ -11,7 +11,10 @@ renderer.paragraph = function(text){
if(!matches) return `\n<p>${text}</p>\n`; if(!matches) return `\n<p>${text}</p>\n`;
let matchIndex = 0; let matchIndex = 0;
const res = _.reduce(text.split(blockReg), (r, text) => { const res = _.reduce(text.split(blockReg), (r, text) => {
console.log(text);
//if(text) r.push(text);
if(text) r.push(Markdown(text, {renderer : renderer, sanitize: true})); if(text) r.push(Markdown(text, {renderer : renderer, sanitize: true}));
const block = matches[matchIndex]; const block = matches[matchIndex];
if(block && block[0] == '{'){ if(block && block[0] == '{'){
r.push(`\n\n<div class="block ${block.substring(2).split(',').join(' ')}">`); r.push(`\n\n<div class="block ${block.substring(2).split(',').join(' ')}">`);
@@ -30,7 +33,7 @@ renderer.image = function(href, title, text){
return `<img src="${href}" class="${text.split(',').join(' ')}"></img>`; return `<img src="${href}" class="${text.split(',').join(' ')}"></img>`;
}; };
renderer.list = function(list, isOrdered, isDef){ renderer.list = function(list, isOrdered, isDef){
if(isDef) return `<ul class='def'>${list}</ul>`; if(isDef) return `<ul class='alt'>${list}</ul>`;
if(isOrdered) return `<ol>${list}</ol>`; if(isOrdered) return `<ol>${list}</ol>`;
return `<ul>${list}</ul>`; return `<ul>${list}</ul>`;
} }

View File

@@ -14,7 +14,7 @@ var block = {
newline: /^\n+/, newline: /^\n+/,
code: /^( {4}[^\n]+\n*)+/, code: /^( {4}[^\n]+\n*)+/,
fences: noop, fences: noop,
hr: /^( *[-*_]){3,} *(?:\n+|$)/, hr: /^( *[-]){3,} *(?:\n+|$)/,
heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
nptable: noop, nptable: noop,
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,

View File

@@ -15,10 +15,6 @@
tbody tr { background-color: transparent }; tbody tr { background-color: transparent };
} }
ul:nth-of-type(1),ul:nth-of-type(2){ ul:nth-of-type(1),ul:nth-of-type(2){
list-style: none;
padding-left : 1em;
text-indent : -1em;
margin-bottom : 0.5em;
strong{ strong{
color : @crimson; color : @crimson;
} }
@@ -98,7 +94,7 @@
z-index : 150; z-index : 150;
width : 200px; width : 200px;
font-size : 0.9em; font-size : 0.9em;
color : @gold; color : @brown;
text-align : right; text-align : right;
} }
//***************************** //*****************************

View File

@@ -1,5 +1,13 @@
//TODO: come up with fun color names //TODO: come up with fun color names
@crimson : #58180D;
@red : #9c2b1b;
@brown : #c9ad6a; //brown?
@green : #e0e5c1;
@yellow : #faf7ea; //same as background?
@teal : blue;
@blue : blue;
@background : #EEE5CE; @background : #EEE5CE;
@noteGreen : #e0e5c1; @noteGreen : #e0e5c1;
@headerUnderline : #c9ad6a; @headerUnderline : #c9ad6a;
@@ -20,13 +28,7 @@
} }
} }
@crimson : #58180D;
@red : #9c2b1b;
@gold : #c9ad6a; //brown?
@green : #e0e5c1;
@yellow : #faf7ea; //same as background?
@teal : blue;
@blue : blue;
//TODO make a color mixin generator //TODO make a color mixin generator
@@ -34,5 +36,6 @@
.blue{ .colorElements(@blue); } .blue{ .colorElements(@blue); }
.green{ .colorElements(@green); } .green{ .colorElements(@green); }
.yellow{ .colorElements(@yellow); } .yellow{ .colorElements(@yellow); }
.gold{ .colorElements(@gold); } .brown{ .colorElements(fade(@brown, 50%)); }
.red{ .colorElements(@red); } .red{ .colorElements(fade(@red, 25%)); }
.crimson{ .colorElements(fade(@crimson, 20%)); }

View File

@@ -135,8 +135,11 @@ ol{
list-style-position : outside; list-style-position : outside;
list-style-type : decimal; list-style-type : decimal;
} }
ul.def{
p+ul.alt{
margin-top : -0.5em; margin-top : -0.5em;
}
ul.alt{
margin-bottom : 0.5em; margin-bottom : 0.5em;
padding-left : 0em; padding-left : 0em;
list-style-position : outside; list-style-position : outside;

View File

@@ -57,7 +57,7 @@
background-size : cover; background-size : cover;
padding: 28px 63px; padding: 28px 63px;
box-sizing: border-box; box-sizing: border-box;
color : lighten(@gold, 0%); color : lighten(@brown, 0%);
font-size: 0.7em; font-size: 0.7em;
} }
&:nth-child(even){ &:nth-child(even){
@@ -81,7 +81,7 @@
bottom : 22px; bottom : 22px;
width : 50px; width : 50px;
font-size : 0.9em; font-size : 0.9em;
color : @gold; color : @brown;
text-align : center; text-align : center;
} }

View File

@@ -12,9 +12,7 @@ const Snips = _.merge(
const BrewSnippets = { const BrewSnippets = {
brew : ()=>{ brew : ()=>{
return _.times(_.random(1,10), ()=>BrewSnippets.page()).join('\n\n\\page\n\n');
}, },
page : ()=>{ page : ()=>{

View File

@@ -12,9 +12,6 @@ const getStats = function(){
const getAttributes = ()=>{ const getAttributes = ()=>{
return ` return `
- **Saving Throws** - **Saving Throws**
- **Condition Immunities** ${Data.rand(["groggy", "swagged", "weak-kneed", "buzzed", "groovy", "melancholy", "drunk"], 3).join(', ')}, - **Condition Immunities** ${Data.rand(["groggy", "swagged", "weak-kneed", "buzzed", "groovy", "melancholy", "drunk"], 3).join(', ')},

View File

@@ -4,7 +4,7 @@ const Data = require('./random.data.js');
module.exports = { module.exports = {
note : ()=>{ note : ()=>{
return `{{note return `{{note,red
##### ${Data.rand('abilities')} ##### ${Data.rand('abilities')}
${Data.rand('sentences', 6, 4).join(' ')} ${Data.rand('sentences', 6, 4).join(' ')}
}}` }}`

View File

@@ -26,7 +26,7 @@ module.exports = {
const description = Data.rand('effects', 2).concat(Data.rand('effects2')).join(' '); const description = Data.rand('effects', 2).concat(Data.rand('effects2')).join(' ');
return `{{spell return `
#### ${_.sample(Data.spellNames)} #### ${_.sample(Data.spellNames)}
*${_.sample(levels)}-level ${_.sample(schools)}* *${_.sample(levels)}-level ${_.sample(schools)}*
- **Casting Time:** ${_.sample(['1 action', 'Reaction', '10 minutes', '1 hour'])} - **Casting Time:** ${_.sample(['1 action', 'Reaction', '10 minutes', '1 hour'])}
@@ -34,8 +34,7 @@ module.exports = {
- **Components:** ${components} - **Components:** ${components}
- **Duration:** ${duration} - **Duration:** ${duration}
${description} ${description}`;
}}`;
}, },
@@ -47,6 +46,6 @@ ${description}
return `##### ${level} \n${spells} \n`; return `##### ${level} \n${spells} \n`;
}).join('\n'); }).join('\n');
return `{{fourColumn,fullPage\n${content}\n}}`; return `{{fourColumn,fullPage,sansSerif\n${content}\n}}`;
} }
} }

View File

@@ -43,6 +43,11 @@ const columns = {
module.exports = { module.exports = {
table : () => { table : () => {
let title = '';
if(Data.chance(5)) title = `##### ${Data.rand(Data.abilities)}\n`;
const rows = _.sample([4,6,8,10]); const rows = _.sample([4,6,8,10]);
let fns = []; let fns = [];
@@ -57,7 +62,7 @@ module.exports = {
const cols = _.map(fns, (fn)=>fn(rows)); const cols = _.map(fns, (fn)=>fn(rows));
return _.times(rows + 2, (i)=>{ return title + _.times(rows + 2, (i)=>{
if(i==1){ if(i==1){
return '|' + _.map(cols, (col)=>col[i]).join('|') + '|'; return '|' + _.map(cols, (col)=>col[i]).join('|') + '|';
}else{ }else{