0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Merge branch 'blockTweaks'

This commit is contained in:
Scott Tolksdorf
2016-06-05 13:50:55 -04:00
9 changed files with 160 additions and 67 deletions

View File

@@ -1,5 +1,17 @@
# changelog
### Sunday, 05/06/2016 - v2.2.1
- Adding in a new Class table div block. The old Class table block used weird stacking of HTML elements, resulting is difficult to control behaviour and poor interactiosn with the rest of the page. This new block is much easier to style and work with.
- Added in a new wide table snippet
- Added in a new auto-incremeting page number snippet (thakns u/Ryrok!)
- Lists in monster stat blocks should be fixed now
### Saturday, 04/06/2016 - v2.2.0
- MIgrating The Homebrewery over to hombrewery.naturalcrit.com. It know runs on it's own server, with it's own repo separate from the other tools I'm working on. Makes updating and deploying much easier.
\page
### Sunday, 29/05/2016 - v2.1.0
- Finally added a syntax for doing spell lists. A bit in-depth about why this took so long. Essentially I'm running out of syntax to use in stardard Markdown. There are too many unique elements in the PHB-style to be mapped. I solved this earlier by stacking certain elements together (eg. an `<hr>` before a `blockquote` turns it into moster state block), but those are getting unweildly. I would like to simply wrap these in `div`s with classes, but unfortunately Markdown stops processing when within HTML blocks. To get around this I wrote my own override to the Markdown parser and lexer to process Markdown within a simple div class wrapper. This should open the door for more unique syntaxes in the future. Big step!
- Override Ctrl+P (and cmd+P) to launch to the print page. Many people try to just print either the editing or share page to get a PDF. While this dones;t make much sense, I do get a ton of issues about it. So now if you try to do this, it'll just bring you imediately to the print page. Everybody wins!

View File

@@ -7,7 +7,7 @@ var renderer = new Markdown.Renderer();
//Processes the markdown within an HTML block if it's just a class-wrapper
renderer.html = function (html) {
if(_.startsWith(html, '<div class=') && _.endsWith(_.trim(html), '</div>')){
if(_.startsWith(_.trim(html), '<div class=') && _.endsWith(_.trim(html), '</div>')){
var openTag = html.substring(0, html.indexOf('>')+1);
html = html.substring(html.indexOf('>')+1);
html = html.substring(0, html.lastIndexOf('</div>'));

View File

@@ -70,8 +70,7 @@ module.exports = {
var cantrips = 3;
var spells = 1;
var slots = 2;
return "##### The " + classname + "\n" +
"___\n" +
return "<div class='classTable wide'>\n##### The " + classname + "\n" +
"| Level | Proficiency Bonus | Features | Cantrips Known | Spells Known | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |\n"+
"|:---:|:---:|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n" +
_.map(levels, function(levelName, level){
@@ -89,15 +88,14 @@ module.exports = {
slots += _.random(0,2);
return "| " + res + " |";
}).join('\n') +'\n\n';
}).join('\n') +'\n</div>\n\n';
},
half : function(classname){
classname = classname || _.sample(classnames)
var featureScore = 1
return "##### The " + classname + "\n" +
"___\n" + "___\n" +
return "<div class='classTable'>\n##### The " + classname + "\n" +
"| Level | Proficiency Bonus | Features | " + _.sample(features) + "|\n" +
"|:---:|:---:|:---|:---:|\n" +
_.map(levels, function(levelName, level){
@@ -111,6 +109,6 @@ module.exports = {
featureScore += _.random(0,1);
return "| " + res + " |";
}).join('\n') +'\n\n';
}).join('\n') +'\n</div>\n\n';
}
};

View File

@@ -57,6 +57,12 @@ module.exports = [
gen : "<div class='pageNumber'>1</div>\n<div class='footnote'>PART 1 | FANCINESS</div>\n\n"
},
{
name : "Auto-incrementing Page Number",
icon : 'fa-sort-numeric-asc',
gen : "<div class='pageNumber auto'></div>\n"
},
]
},
@@ -141,6 +147,24 @@ module.exports = [
"| 17th | 4 or lower |\n\n",
].join('\n');
},
},
{
name : 'Wide Table',
icon : 'fa-list',
gen : function(){
return [
"<div class='wide'>",
"##### Cookie Tastiness",
"| Tastiness | Cookie Type |",
"|:----:|:-------------|",
"| -5 | Raisin |",
"| 8th | Chocolate Chip |",
"| 11th | 2 or lower |",
"| 14th | 3 or lower |",
"| 17th | 4 or lower |",
"</div>\n\n"
].join('\n');
},
}
]
},

View File

@@ -11,7 +11,7 @@ var Navbar = React.createClass({
<Nav.item href='/' className='homebrewLogo'>
<div>The Homebrewery</div>
</Nav.item>
<Nav.item>v2.2.0</Nav.item>
<Nav.item>v2.2.1</Nav.item>
</Nav.section>
{this.props.children}
</Nav.base>

View File

@@ -0,0 +1,31 @@
.phb{
//Double hr for full width elements
hr+hr+blockquote{
column-span : all;
-webkit-column-span : all;
-moz-column-span : all;
}
//*****************************
// * CLASS TABLE
// *****************************/
hr+table{
margin-top : -5px;
margin-bottom : 50px;
padding-top : 10px;
border-collapse : separate;
background-color : white;
border : initial;
border-style : solid;
border-image-outset : 37px 17px;
border-image-repeat : round;
border-image-slice : 150 200 150 200;
border-image-source : @frameBorderImage;
border-image-width : 47px;
}
h5+hr+table{
column-span : all;
-webkit-column-span : all;
-moz-column-span : all;
}
}

View File

@@ -2,6 +2,7 @@
@import (less) 'shared/naturalcrit/styles/reset.less';
@import (less) './client/homebrew/phbStyle/phb.fonts.css';
@import (less) './client/homebrew/phbStyle/phb.assets.less';
@import (less) './client/homebrew/phbStyle/phb.depricated.less';
//Colors
@background : #EEE5CE;
@noteGreen : #e0e5c1;
@@ -10,6 +11,9 @@
@headerText : #58180D;
@monsterStatBackground : #FDF1DC;
@page { margin: 0; }
body {
counter-reset: phb-page-numbers;
}
.useSansSerif(){
font-family : ScalySans;
em{
@@ -212,13 +216,13 @@
font-weight : 400;
border-bottom : 1px solid @headerText;
}
hr+ul{
color : @headerText;
}
ul{
.useSansSerif();
padding-left : 1em;
font-size : 0.352cm;
color : @headerText;
text-indent : -1em;
list-style-type : none;
}
// Monster Ability table
hr+table{
@@ -256,28 +260,7 @@
hr+hr+blockquote{
.useColumns(0.96);
}
//*****************************
// * CLASS TABLE
// *****************************/
hr+table{
margin-top : -5px;
margin-bottom : 50px;
padding-top : 10px;
border-collapse : separate;
background-color : white;
border : initial;
border-style : solid;
border-image-outset : 37px 17px;
border-image-repeat : round;
border-image-slice : 150 200 150 200;
border-image-source : @frameBorderImage;
border-image-width : 47px;
}
h5+hr+table{
column-span : all;
-webkit-column-span : all;
-moz-column-span : all;
}
//*****************************
// * FOOTER
// *****************************/
@@ -311,6 +294,11 @@
font-size : 0.9em;
color : #c9ad6a;
text-align : center;
&.auto::after {
counter-increment: phb-page-numbers;
content: counter(phb-page-numbers);
}
}
.footnote{
position : absolute;
@@ -335,12 +323,7 @@
text-indent : -1em;
list-style-type : none;
}
//Double hr for full width elements
hr+hr+blockquote{
column-span : all;
-webkit-column-span : all;
-moz-column-span : all;
}
//Column Break
pre, code{
visibility : hidden;
@@ -411,4 +394,26 @@
column-span : all;
-webkit-column-span : all;
-moz-column-span : all;
}
//*****************************
// * CLASS TABLE
// *****************************/
.phb .classTable{
margin-top : 25px;
margin-bottom : 40px;
border-collapse : separate;
background-color : white;
border : initial;
border-style : solid;
border-image-outset : 25px 17px;
border-image-repeat : round;
border-image-slice : 150 200 150 200;
border-image-source : @frameBorderImage;
border-image-width : 47px;
h5{
margin-bottom: 10px;
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown",
"version": "2.2.0",
"version": "2.2.1",
"scripts": {
"postinstall": "gulp prod",
"start": "node server.js"

File diff suppressed because one or more lines are too long