diff --git a/shared/depricated/snippets_old/tableOfContents.gen.js b/shared/depricated/snippets_old/tableOfContents.gen.js index 448b2f4e1..ed1381a8e 100644 --- a/shared/depricated/snippets_old/tableOfContents.gen.js +++ b/shared/depricated/snippets_old/tableOfContents.gen.js @@ -48,7 +48,7 @@ const getTOC = (pages) => { } module.exports = function(brew){ - const pages = brew.split('\\page'); + const TOC = getTOC(pages); const markdown = _.reduce(TOC, (r, g1, idx1)=>{ r.push(`- **[${idx1 + 1} ${g1.title}](#p${g1.page})**`) diff --git a/shared/homebrewery/brewEditor/menubar/snippetGroup/snippetGroup.jsx b/shared/homebrewery/brewEditor/menubar/snippetGroup/snippetGroup.jsx index 8268e0eda..fd36d7a54 100644 --- a/shared/homebrewery/brewEditor/menubar/snippetGroup/snippetGroup.jsx +++ b/shared/homebrewery/brewEditor/menubar/snippetGroup/snippetGroup.jsx @@ -6,7 +6,6 @@ const cx = require('classnames'); const SnippetGroup = React.createClass({ getDefaultProps: function() { return { - brew : '', name : '', icon : 'fa-rocket', snippets : [], diff --git a/shared/homebrewery/phb_style/phb.blocks.less b/shared/homebrewery/phb_style/phb.blocks.less index 2e3c7775b..f6630546d 100644 --- a/shared/homebrewery/phb_style/phb.blocks.less +++ b/shared/homebrewery/phb_style/phb.blocks.less @@ -1,5 +1,4 @@ - /////////////////// .spell{ ul:first-of-type{ @@ -16,7 +15,7 @@ .monster{ .breakAvoid(); .pseudoBorder(); - padding : 10px 5px; + padding : 10px 5px; table{ color : @headerText; } @@ -86,7 +85,6 @@ border-image-width : 47px; } } - .footnote{ position : absolute; right : 80px; @@ -97,13 +95,46 @@ color : @gold; text-align : right; } - - //***************************** // * TABLE OF CONTENTS // *****************************/ .toc{ - .breakAvoid(); + h1{ + text-align : center; + } + li{ + margin-bottom : 3px; + strong, em::after{ + font-family : BookInsanity; + font-size : 13px; + font-style : normal; + font-weight : 500; + color : black; + } + em{ + display : block; + overflow : hidden; + width : auto; + font-style : normal; + white-space : nowrap; + &:after{ + content : " .............................................................................................................."; + } + } + strong{ + float : right; + margin-left : 4px; + } + h3{ + margin-top : 15px; + em{ color : @crimson; } + em::after{ display : none; } + } + h4{ + margin-top : 10px; + em{ color : @crimson; } + } + } a{ color : black; text-decoration : none; @@ -115,17 +146,7 @@ padding-left : 0; list-style-type : none; } - &>ul>li{ - margin-bottom : 10px; - } } - - - - - - - .wide{ column-span : all; -webkit-column-span : all; @@ -133,25 +154,25 @@ } .oneColumn{ column-count : 1; - column-gap : 1cm; +// column-gap : 1cm; } .twoColumn{ column-count : 2; - column-gap : 1cm; + //column-fill: auto; + ////column-gap : 1cm; } .threeColumn{ column-count : 3; - column-gap : 1cm; + //column-gap : 1cm; } .fourColumn{ column-count : 4; - column-gap : 1cm; + //column-gap : 1cm; } .columnSplit{ visibility : hidden; - -webkit-column-break-after : always; - break-after : always; - -moz-column-break-after : always; + -webkit-column-break-bfore : always; + break-before : column; } .brushed{ border-image-outset : 25px 17px; diff --git a/shared/homebrewery/phb_style/phb.colors.less b/shared/homebrewery/phb_style/phb.colors.less index 3f92db140..35f82f24f 100644 --- a/shared/homebrewery/phb_style/phb.colors.less +++ b/shared/homebrewery/phb_style/phb.colors.less @@ -20,6 +20,7 @@ } } +@crimson : #58180D; @red : #9c2b1b; @gold : #c9ad6a; //brown? @green : #e0e5c1; diff --git a/shared/homebrewery/snippets/brew/classTable.snippet.js b/shared/homebrewery/snippets/brew/class.snippet.js similarity index 100% rename from shared/homebrewery/snippets/brew/classTable.snippet.js rename to shared/homebrewery/snippets/brew/class.snippet.js diff --git a/shared/homebrewery/snippets/brew/index.js b/shared/homebrewery/snippets/brew/index.js index d1f9b0b93..0cb4d4f56 100644 --- a/shared/homebrewery/snippets/brew/index.js +++ b/shared/homebrewery/snippets/brew/index.js @@ -3,9 +3,10 @@ const _ = require('lodash'); module.exports = _.merge( require('./spell.snippet.js'), require('./table.snippet.js'), - require('./classTable.snippet.js'), + require('./class.snippet.js'), require('./note.snippet.js'), - require('./monster.snippet.js') + require('./monster.snippet.js'), + require('./toc.snippet.js') //wide diff --git a/shared/homebrewery/snippets/brew/toc.snippet.js b/shared/homebrewery/snippets/brew/toc.snippet.js new file mode 100644 index 000000000..bd4116861 --- /dev/null +++ b/shared/homebrewery/snippets/brew/toc.snippet.js @@ -0,0 +1,112 @@ +const _ = require('lodash'); +const Store = require('homebrewery/brew.store.js'); + +const getTOC = (text) => { + const pages = text.split('\\page'); + const add1 = (title, page)=>{ + res.push({ + title : title, + page : page + 1, + children : [] + }); + } + const add2 = (title, page)=>{ + if(!_.last(res)) add1('', page); + _.last(res).children.push({ + title : title, + page : page + 1, + children : [] + }); + } + const add3 = (title, page)=>{ + if(!_.last(res)) add1('', page); + if(!_.last(_.last(res).children)) add2('', page); + _.last(_.last(res).children).children.push({ + title : title, + page : page + 1, + children : [] + }); + } + + let res = []; + _.each(pages, (page, pageNum)=>{ + const lines = page.split('\n'); + _.each(lines, (line) => { + if(_.startsWith(line, '# ')){ + const title = line.replace('# ', ''); + add1(title, pageNum) + } + if(_.startsWith(line, '## ')){ + const title = line.replace('## ', ''); + add2(title, pageNum); + } + if(_.startsWith(line, '### ')){ + const title = line.replace('### ', ''); + add3(title, pageNum); + } + }) + }); + return res; +} + + +module.exports = { + //TODO: TOC not perfect yet + + toc : (text)=>{ + text = text || Store.getBrewCode(); + + console.log(getTOC(text)); + + const TOC = getTOC(text) + + const markdown = _.reduce(TOC, (r, g1, idx1)=>{ + r.push(`- ### [**${g1.page}** *${g1.title}*](#p${g1.page})`) + if(g1.children.length){ + _.each(g1.children, (g2, idx2) => { + r.push(` - #### [**${g2.page}** *${g2.title}*](#p${g2.page})`) + if(g2.children.length){ + _.each(g2.children, (g3, idx3) => { + r.push(` - [**${g3.page}** *${g3.title}*](#p${g3.page})`) + }); + } + }); + } + return r; + }, []).join('\n'); + + + + return `{{toc +# Contents + +${markdown} + +}}`; +/* + +- ### [**4** *Preface*](#p3) +- ### [**5** *Introduction*](#p3) + - [**5** *Worlds of Adventure*](#p5) + - [**6** *Using This Book*](#p5) + - [**6** *How to Play*](#p5) + - [**7** *Adventures*](#p5) + +- ### [**5** *Introduction*](#p3) + - #### [**5** *Worlds of Adventure*](#p5) + - [**6** *Using This Book*](#p5) + - [**6** *How to Play*](#p5) + - #### [**7** *Adventures*](#p5) + + + + + + + +}} + + +`;*/ + } +} \ No newline at end of file diff --git a/statics/faq.md b/statics/faq.md index ef045cf99..59eb9bdf1 100644 --- a/statics/faq.md +++ b/statics/faq.md @@ -9,7 +9,9 @@ # Images - +Image basics +- background images +- Adding brushes How to make spacers @@ -22,6 +24,18 @@ How to make spacers #p2:before{ counter-reset: phb-page-numbers 30; } +- blockquotes, cite + +styling images + + +# Print +- Saving ink +- Changing page size +- Printing to PDF + + + ## Changing backgrounds {{wide In style @@ -33,3 +47,61 @@ In style ``` }} +## Changes in v3 + +``` ``` -> \column + + +\page + +## Columns +{{wide,twoColumn +This is how columns work sdfsdfsdf +``` +{{twoColumn + +| d4 | Manicurist Level | Equipment | +|:---:|:---:|:---| +| 1 | 1st | The four fragments of the Disk of Madness | +| 2 | 3rd | Broch of Air Blasts | +| 3 | 5th | The four fragments of the Disk of Madness | +| 4 | 7th | 3rd born child | + + +| d4 | Manicurist Level | Equipment | +|:---:|:---:|:---| +| 1 | 1st | The four fragments of the Disk of Madness | +| 2 | 3rd | Broch of Air Blasts | +| 3 | 5th | The four fragments of the Disk of Madness | +| 4 | 7th | 3rd born child | + +}} + +``` + +\column + + +{{twoColumn + +| d4 | Manicurist Level | Equipment | +|:---:|:---:|:---| +| 1 | 1st | The four fragments of the Disk of Madness | +| 2 | 3rd | Broch of Air Blasts | +| 3 | 5th | The four fragments of the Disk of Madness | +| 4 | 7th | 3rd born child | + + +| d4 | Manicurist Level | Equipment | +|:---:|:---:|:---| +| 1 | 1st | The four fragments of the Disk of Madness | +| 2 | 3rd | Broch of Air Blasts | +| 3 | 5th | The four fragments of the Disk of Madness | +| 4 | 7th | 3rd born child | + +}} + +}} + +this is after + diff --git a/statics/test.brew.md b/statics/test.brew.md index 0442caa6a..9fe7bb0a7 100644 --- a/statics/test.brew.md +++ b/statics/test.brew.md @@ -34,18 +34,13 @@ This tool will **always** be free, never have ads, and I will never offer any "p }} +> This is a cool blockquote fdgfgsfg sfd sdfsdfsdfsdfsdfsdf sdfsdfsdfssdfsdffgsdfgsdfg +> You know? +> +> One with quotes and what not +> yeah yeah yeah +> {{cite -- Very cool person }} ->##### PDF Exporting -> PDF Printing works best in Chrome. If you are having quality/consistency issues, try using Chrome to print instead. -> -> After clicking the "Print" item in the navbar a new page will open and a print dialog will pop-up. -> * Set the **Destination** to "Save as PDF" -> * Set **Paper Size** to "Letter" -> * If you are printing on A4 paper, make sure to have the "A4 page size snippet" in your brew -> * In **Options** make sure "Background Images" is selected. -> * Hit print and enjoy! You're done! -> -> If you want to save ink or have a monochrome printer, add the **Ink Friendly** snippet to your brew before you print {{note ##### PDF Exporting @@ -64,7 +59,7 @@ This tool will **always** be free, never have ads, and I will never offer any "p }} - +![test](http://i.imgur.com/hMna6G0.png) ``` cool stuff @@ -91,12 +86,9 @@ If you are looking for more 5e Homebrew resources check out [r/UnearthedArcana]( - - -
1
-
PART 1 | FANCINESS
+{{footnote PART 1 | FANCINESS }} \page