0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-12 13:12:46 +00:00

Added dropcap style, making page snippet

This commit is contained in:
Scott Tolksdorf
2017-06-04 11:39:47 -04:00
parent 87a9c46202
commit a30bd79399
8 changed files with 99 additions and 27 deletions

View File

@@ -30,7 +30,6 @@ renderer.image = function(href, title, text){
return `<img src="${href}" class="${text.split(',').join(' ')}"></img>`;
};
module.exports = {
marked : Markdown,
render : (rawBrewText)=>{

View File

@@ -208,4 +208,13 @@
}
.sansSerif{
.useSansSerif();
}
.dropcap{
p::first-letter{
float : left;
font-family : Solbera;
font-size : 10em;
color : #222;
line-height : 0.8em;
}
}

View File

@@ -26,12 +26,18 @@ p{
&+p{
margin-top : -0.8em;
}
}
blockquote{
font-style : italic;
&>p{
line-height: 1.8em;
//Why did I do this?
&:first-child::first-line{
//TODO: Find the right font for block quotes
@@ -49,13 +55,27 @@ blockquote{
}
// IMAGE
img{
z-index : -1;
display: block;
&.center{
margin-right: auto;
margin-left: auto;
}
}
//Indents after p or lists
p+p, ul+p, ol+p{
text-indent : 1em;
}
img{
z-index : -1;
}
strong{
font-weight : bold;
letter-spacing : 0.03em;
@@ -88,13 +108,6 @@ h1{
font-size : 0.987cm;
-webkit-column-span : all;
-moz-column-span : all;
&+p::first-letter{
float : left;
font-family : Solbera;
font-size : 10em;
color : #222;
line-height : 0.8em;
}
}
h2{
font-size : 0.705cm;
@@ -147,6 +160,7 @@ ol{
// *****************************/
table{
.useSansSerif();
break-inside: avoid-column;
width : 100%;
margin-bottom : 1em;
font-size : 10pt;

View File

@@ -0,0 +1,48 @@
const _ = require('lodash');
const Data = require('./random.data.js');
const Snips = _.merge(
require('./spell.snippet.js'),
require('./table.snippet.js'),
require('./class.snippet.js'),
require('./note.snippet.js'),
require('./monster.snippet.js')
);
const BrewSnippets = {
brew : ()=>{
},
page : ()=>{
const base = [
BrewSnippets.paragraph, BrewSnippets.paragraph, BrewSnippets.paragraph, BrewSnippets.paragraph,
BrewSnippets.paragraph, BrewSnippets.paragraph, BrewSnippets.paragraph, BrewSnippets.paragraph,
Snips.table, Snips.table,
Snips.note, Snips.note, Snips.altnote,
Snips.monster,
BrewSnippets.title,BrewSnippets.title,BrewSnippets.title
]
const fns = Data.mix(base, 15, 10);
return _.map(fns, (fn)=>fn()).join('\n\n');
},
paragraph : (dropcap = false)=>{
let res = Data.rand(Data.sentences, 6, 3).join(' ');
if(dropcap || Data.chance(20)) res = `{{dropcap\n${res}\n}}`;
return res;
},
title : ()=>{
return _.sample(['##', '###', '##', '###','####', '#####']) + ' ' + Data.rand('titles');
}
}
module.exports = BrewSnippets;

View File

@@ -8,7 +8,8 @@ module.exports = _.merge(
require('./monster.snippet.js'),
require('./toc.snippet.js'),
require('./random.brew.js')
//require('./random.brew.js')
require('./brew.snippet.js')

View File

@@ -17,8 +17,8 @@ const getAttributes = ()=>{
return `
- **Saving Throws**
- **Condition Immunities** " + genList(["groggy", "swagged", "weak-kneed", "buzzed", "groovy", "melancholy", "drunk"], 3),
- **Senses** passive Perception " + _.random(3, 20),
- **Condition Immunities** ${Data.rand(["groggy", "swagged", "weak-kneed", "buzzed", "groovy", "melancholy", "drunk"], 3).join(', ')},
- **Senses** passive Perception " ${_.random(3, 20)},
- **Languages** ${Data.rand(["Common", "Pottymouth", "Gibberish", "Latin", "Jive"], 2).join(', ')}
- **Challenge** ${_.random(0, 15)} (${_.random(10,10000)} XP)
`;
@@ -45,23 +45,16 @@ module.exports = {
*${Data.rand('sizes')}, ${Data.rand('alignments')}*
---
- **Armor Class** ${_.random(10,20)}
- **Hit Points** ${_.random(1, 150)} (1d4 + 5)
- **Speed** ${ _.random(0,50)} ft
---
|STR|DEX|CON|INT|WIS|CHA|
|:---:|:---:|:---:|:---:|:---:|:---:|
${getStats()}
---
${getAttributes()}
---
Abilities

View File

@@ -5,7 +5,9 @@ const Data = {
const data = (Data[name] ? Data[name] : name);
return _.sampleSize(data, _.random(min, max));
},
//Boolean of 1 in n chance
chance : (max = 20)=>_.random(1,max)== 1,
mix : (list, max = 1, min = 1)=>_.times(_.random(min, max), ()=>_.sample(list)),
titles : [
`The Burning Gallows`,
`The Ring of Nenlast`,

View File

@@ -45,11 +45,17 @@ module.exports = {
table : () => {
const rows = _.sample([4,6,8,10]);
const cols = [
columns.roll(rows),
columns.level(rows),
columns.gear(rows)
];
let fns = [];
if(Data.chance(3)) fns.push(columns.roll);
fns = _.concat(fns, Data.rand([
columns.level,
columns.spell,
columns.cost,
columns.gear
], 3, 2 - fns.length))
const cols = _.map(fns, (fn)=>fn(rows));
return _.times(rows + 2, (i)=>{
if(i==1){