mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 13:02:45 +00:00
Added dropcap style, making page snippet
This commit is contained in:
@@ -30,7 +30,6 @@ renderer.image = function(href, title, text){
|
|||||||
return `<img src="${href}" class="${text.split(',').join(' ')}"></img>`;
|
return `<img src="${href}" class="${text.split(',').join(' ')}"></img>`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
marked : Markdown,
|
marked : Markdown,
|
||||||
render : (rawBrewText)=>{
|
render : (rawBrewText)=>{
|
||||||
|
|||||||
@@ -208,4 +208,13 @@
|
|||||||
}
|
}
|
||||||
.sansSerif{
|
.sansSerif{
|
||||||
.useSansSerif();
|
.useSansSerif();
|
||||||
|
}
|
||||||
|
.dropcap{
|
||||||
|
p::first-letter{
|
||||||
|
float : left;
|
||||||
|
font-family : Solbera;
|
||||||
|
font-size : 10em;
|
||||||
|
color : #222;
|
||||||
|
line-height : 0.8em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -26,12 +26,18 @@ p{
|
|||||||
&+p{
|
&+p{
|
||||||
margin-top : -0.8em;
|
margin-top : -0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
blockquote{
|
blockquote{
|
||||||
font-style : italic;
|
font-style : italic;
|
||||||
&>p{
|
&>p{
|
||||||
line-height: 1.8em;
|
line-height: 1.8em;
|
||||||
|
|
||||||
|
//Why did I do this?
|
||||||
&:first-child::first-line{
|
&:first-child::first-line{
|
||||||
|
|
||||||
//TODO: Find the right font for block quotes
|
//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
|
//Indents after p or lists
|
||||||
p+p, ul+p, ol+p{
|
p+p, ul+p, ol+p{
|
||||||
text-indent : 1em;
|
text-indent : 1em;
|
||||||
}
|
}
|
||||||
img{
|
|
||||||
z-index : -1;
|
|
||||||
}
|
|
||||||
strong{
|
strong{
|
||||||
font-weight : bold;
|
font-weight : bold;
|
||||||
letter-spacing : 0.03em;
|
letter-spacing : 0.03em;
|
||||||
@@ -88,13 +108,6 @@ h1{
|
|||||||
font-size : 0.987cm;
|
font-size : 0.987cm;
|
||||||
-webkit-column-span : all;
|
-webkit-column-span : all;
|
||||||
-moz-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{
|
h2{
|
||||||
font-size : 0.705cm;
|
font-size : 0.705cm;
|
||||||
@@ -147,6 +160,7 @@ ol{
|
|||||||
// *****************************/
|
// *****************************/
|
||||||
table{
|
table{
|
||||||
.useSansSerif();
|
.useSansSerif();
|
||||||
|
break-inside: avoid-column;
|
||||||
width : 100%;
|
width : 100%;
|
||||||
margin-bottom : 1em;
|
margin-bottom : 1em;
|
||||||
font-size : 10pt;
|
font-size : 10pt;
|
||||||
|
|||||||
48
shared/homebrewery/snippets/brew/brew.snippet.js
Normal file
48
shared/homebrewery/snippets/brew/brew.snippet.js
Normal 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;
|
||||||
@@ -8,7 +8,8 @@ module.exports = _.merge(
|
|||||||
require('./monster.snippet.js'),
|
require('./monster.snippet.js'),
|
||||||
require('./toc.snippet.js'),
|
require('./toc.snippet.js'),
|
||||||
|
|
||||||
require('./random.brew.js')
|
//require('./random.brew.js')
|
||||||
|
require('./brew.snippet.js')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ const getAttributes = ()=>{
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
- **Saving Throws**
|
- **Saving Throws**
|
||||||
- **Condition Immunities** " + genList(["groggy", "swagged", "weak-kneed", "buzzed", "groovy", "melancholy", "drunk"], 3),
|
- **Condition Immunities** ${Data.rand(["groggy", "swagged", "weak-kneed", "buzzed", "groovy", "melancholy", "drunk"], 3).join(', ')},
|
||||||
- **Senses** passive Perception " + _.random(3, 20),
|
- **Senses** passive Perception " ${_.random(3, 20)},
|
||||||
- **Languages** ${Data.rand(["Common", "Pottymouth", "Gibberish", "Latin", "Jive"], 2).join(', ')}
|
- **Languages** ${Data.rand(["Common", "Pottymouth", "Gibberish", "Latin", "Jive"], 2).join(', ')}
|
||||||
- **Challenge** ${_.random(0, 15)} (${_.random(10,10000)} XP)
|
- **Challenge** ${_.random(0, 15)} (${_.random(10,10000)} XP)
|
||||||
`;
|
`;
|
||||||
@@ -45,23 +45,16 @@ module.exports = {
|
|||||||
*${Data.rand('sizes')}, ${Data.rand('alignments')}*
|
*${Data.rand('sizes')}, ${Data.rand('alignments')}*
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- **Armor Class** ${_.random(10,20)}
|
- **Armor Class** ${_.random(10,20)}
|
||||||
- **Hit Points** ${_.random(1, 150)} (1d4 + 5)
|
- **Hit Points** ${_.random(1, 150)} (1d4 + 5)
|
||||||
- **Speed** ${ _.random(0,50)} ft
|
- **Speed** ${ _.random(0,50)} ft
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|STR|DEX|CON|INT|WIS|CHA|
|
|STR|DEX|CON|INT|WIS|CHA|
|
||||||
|:---:|:---:|:---:|:---:|:---:|:---:|
|
|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||||
${getStats()}
|
${getStats()}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
${getAttributes()}
|
${getAttributes()}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Abilities
|
Abilities
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ const Data = {
|
|||||||
const data = (Data[name] ? Data[name] : name);
|
const data = (Data[name] ? Data[name] : name);
|
||||||
return _.sampleSize(data, _.random(min, max));
|
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 : [
|
titles : [
|
||||||
`The Burning Gallows`,
|
`The Burning Gallows`,
|
||||||
`The Ring of Nenlast`,
|
`The Ring of Nenlast`,
|
||||||
|
|||||||
@@ -45,11 +45,17 @@ module.exports = {
|
|||||||
table : () => {
|
table : () => {
|
||||||
const rows = _.sample([4,6,8,10]);
|
const rows = _.sample([4,6,8,10]);
|
||||||
|
|
||||||
const cols = [
|
let fns = [];
|
||||||
columns.roll(rows),
|
if(Data.chance(3)) fns.push(columns.roll);
|
||||||
columns.level(rows),
|
|
||||||
columns.gear(rows)
|
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)=>{
|
return _.times(rows + 2, (i)=>{
|
||||||
if(i==1){
|
if(i==1){
|
||||||
|
|||||||
Reference in New Issue
Block a user