From 70217155435d9bd32b488efb3153cae92993c79f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Tue, 10 Aug 2021 00:51:30 -0400 Subject: [PATCH 01/15] /v3_preview page will show a v3 version of the homepage --- client/homebrew/homebrew.jsx | 1 + client/homebrew/pages/homePage/homePage.jsx | 9 +- .../homebrew/pages/homePage/welcome_msg_v3.md | 174 ++++++++++++++++++ server.js | 33 +++- shared/naturalcrit/markdown.js | 4 +- 5 files changed, 207 insertions(+), 14 deletions(-) create mode 100644 client/homebrew/pages/homePage/welcome_msg_v3.md diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 118c21e91..aa7b04a63 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -49,6 +49,7 @@ const Homebrew = createClass({ }/> }/> }/> + }/> }/> diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx index b8ee5634b..dfb4908a0 100644 --- a/client/homebrew/pages/homePage/homePage.jsx +++ b/client/homebrew/pages/homePage/homePage.jsx @@ -1,6 +1,7 @@ require('./homePage.less'); const React = require('react'); const createClass = require('create-react-class'); +const _ = require('lodash'); const cx = require('classnames'); const request = require('superagent'); const { Meta } = require('vitreum/headtags'); @@ -49,9 +50,9 @@ const HomePage = createClass({ this.refs.editor.update(); }, handleTextChange : function(text){ - this.setState({ - brew : { text: text } - }); + this.setState((prevState)=>({ + brew : _.merge({}, prevState.brew, { text: text }) + })); }, renderNavbar : function(){ return @@ -81,7 +82,7 @@ const HomePage = createClass({ renderer={this.state.brew.renderer} showEditButtons={false} /> - + diff --git a/client/homebrew/pages/homePage/welcome_msg_v3.md b/client/homebrew/pages/homePage/welcome_msg_v3.md new file mode 100644 index 000000000..6377e934c --- /dev/null +++ b/client/homebrew/pages/homePage/welcome_msg_v3.md @@ -0,0 +1,174 @@ +```css +.page #example + table td { + border:1px dashed #00000030; +} + + +``` + +# The Homebrewery *V3* +Welcome traveler from an antique land. Please sit and tell us of what you have seen. The unheard of monsters, who slither and bite. Tell us of the wondrous items and and artifacts you have found, their mysteries yet to be unlocked. Of the vexing vocations and surprising skills you have seen. + +### Homebrew D&D made easy +The Homebrewery makes the creation and sharing of authentic looking Fifth-Edition homebrews easy. It uses [Markdown](https://help.github.com/articles/markdown-basics/) with a little CSS magic to make your brews come to life. + +**Try it!** Simply edit the text on the left and watch it *update live* on the right. + +### Editing and Sharing +When you create your own homebrew, you will be given a *edit url* and a *share url*. + +Any changes you make while on the *edit url* will be automatically saved to the database within a few seconds. Anyone with the edit url will be able to make edits to your homebrew, so be careful about who you share it with. + +Anyone with the *share url* will be able to access a read-only version of your homebrew. + +### PDF Creation +PDF Printing works best in Google 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 + + + +\column + +## New in V3.0.0 +With the latest major update to *The Homebrewery* we've implemented an extended Markdown-like syntax for block and span elements, plus a few other changes, eliminating the need for HTML tags like `div` and `span` in most cases. No raw HTML tags should be needed in a brew, and going forward, raw HTML will no longer receive debugging support (*but can still be used if you insist*). + +All brews made prior to the release of v3.0.0 will still render normally, and you may switch between the "legacy" brew renderer and the newer "V3" renderer via the {{fa,fa-info-circle}} **Properties** button on your brew. Much of the syntax and styling has changed in V3, so code in one version may be broken in the other. + +Scroll down to the next page for a brief summary of the changes and new features available in V3! + +#### New Things All The Time! +What's new in the latest update? Check out the full changelog [here](/changelog). + +### Helping out +Like this tool? Want to buy me a beer? [Head here](https://www.patreon.com/Naturalcrit) to help me keep the servers running. + +This tool will **always** be free, never have ads, and I will never offer any "premium" features or whatever. + +### Bugs, Issues, Suggestions? +Need help getting started or just the right look for your brew? Head to [r/Homebrewery](https://www.reddit.com/r/homebrewery/submit?selftext=true&title=%5BIssue%5D%20Describe%20Your%20Issue%20Here) and let us know! + +Have an idea of how to make The Homebrewery better? Or did you find something that wasn't quite right? Check out the [GitHub Repo](https://github.com/naturalcrit/homebrewery/) to report technical issues. + + + +### Legal Junk +The Homebrewery is licensed using the [MIT License](https://github.com/naturalcrit/homebrewery/blob/master/license). Which means you are free to use The Homebrewery any way that you want, except for claiming that you made it yourself. + +If you wish to sell or in some way gain profit for what's created on this site, it's your responsibility to ensure you have the proper licenses/rights for any images or resources used. + +#### Crediting Me +If you'd like to credit The Homebrewery in your brew, I'd be flattered! Just reference that you made it with The Homebrewery. + +### More Resources +If you are looking for more 5e Homebrew resources check out [r/UnearthedArcana](https://www.reddit.com/r/UnearthedArcana/) and their list of useful resources [here](https://www.reddit.com/r/UnearthedArcana/comments/3uwxx9/resources_open_to_the_community/). + + + + + +
1
+
PART 1 | FANCINESS
+ + + + +\page + +## Markdown+ +Homebrewery aims to make homebrewering as simple as possible, providing a live editor in combination with Markdown syntax for formatting. + +In version 3.0.0, with a goal of retaining maximum flexibility while elmininating the need for any HTML in a brew, Homebrewery has developed additional Markdown-like syntax. + +{{text-align:center +**You must enable v3 via the metadata editor!** +}} + + +### Curly Brackets +The biggest change in version 3 is the replacement of `` and `
` with `{{ }}`. Inline spans and block elements can be created and given ID's and Classes, as well as css properties, each of which are comma separated with no spaces. Spans and Blocks start the same: + +#### Span +My favorite author is {{pen,#author,color:orange,font-family:"trebuchet ms" Brandon Sanderson}}. The orange text is given a class of `pen`, and id of `author`, colored orange, and given a new font. + + +#### Block +{{purple,#book,background:#aa88aa55,text-align:center +My favorite book is Wheel of Time. This block has a class of `purple`, an id of `book`, and has been styled with a purple background and centered text. +}} + + +#### Injection +For any element that is not inside a span or block, you can *inject* attributes using the same syntax but with single brackets immediately after the element. Below, a width and border are set for an image: + +![alt-text](https://s-media-cache-ak0.pinimg.com/736x/4a/81/79/4a8179462cfdf39054a418efd4cb743e.jpg) {width:100px,border:"2px solid",border-radius:10px} + +\* *this does not currently work for tables yet* + +### Vertical Spacing +The HTML tag `
` has been replaced by either a single `:` along on a line, or multiple `:` on the same line. + +:: + +Much nicer than `




` + +### Definition Lists +V3 uses HTML *definition lists* to create "lists" with hanging indents. + + +**Condition Immunities** :: Here is some text that is long and overflows into a second line, creating a "hanging indent". +**Senses** :: Here is some text that is long and overflows into a second line, creating a "hanging indent". + + + +\column + +### Tables +New in v3.0.0 is the option to add column & row spanning between cells. You can see a working example in the updated Class Table Snippet, but a simplified example is given below. + +A cell can be spanned across columns by bunching pipe `|` characters together. + +Row spanning is achieved by adding a `^` at the end of a cell just before the `|`. + +These can be combined to span a cell across both columns and rows. Cells must have the same colspan if they are to be rowspan'd. + +##### Example +| | Spanned Header || +| Head A | Head B | Head C | +|:-------|:-------|:-------| +| 1A | 1B | 1C | +| 2A ^| 2B | 2C | +| 3A ^| 3B 3C || +| 4A | 4B 4C^|| +| 5A ^| 5B | 5C | +| 6A | 6B ^| 6C | + + +## Images +Images must be hosted online somewhere, like [Imgur](https://www.imgur.com). You use the address to that image to reference it in your brew\*. Images can be included using Markdown-style images. + +Using *Curly Injection* you can assign an id, classes, or specific inline CSS properties to the image. + +::: + +\* *When using Imgur-hosted images, use the "direct link", which can be found when you click into your image in the Imgur interace.* + +## Snippets +Homebrewery comes with a series of *code snippets* found at the top of the editor pane that make it easy to create brews as quickly as possible. Just set your cursor where you want the code to appear in the editor pane, choose a snippet, and make the adjustments you need. + + +## Style Editor Panel + +{{fa,fa-paint-brush}}Also, technically released prior to v3 but still new to many users, check out the new **Style Editor** located on the right side of the Snippet bar. This editor excepts CSS for styling without requiring `' ].join('\n') }, + { + name : 'Square Page Size', + icon : 'far fa-file', + gen : ['' + ].join('\n') + }, { name : 'Ink Friendly', icon : 'fas fa-tint', From a63949636ebe60eeffffd796f26491fa8c1d2c7f Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 10 Aug 2021 22:02:46 -0500 Subject: [PATCH 03/15] Update Ink Friendly snippet for v3 updated the ink friendly snippet so that it points to elements like .monster rather than hr+blockquote. Goes further than original snippet by setting white background for monster, note, descriptive blocks. Did not update Legacy. --- client/homebrew/editor/snippetbar/snippets/snippets.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index d68cc32ac..6e26ab9ee 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -319,9 +319,9 @@ module.exports = [ name : 'Ink Friendly', icon : 'fas fa-tint', gen : ['', '' ].join('\n') From af8ca7141d4e298aa5d10f96c05809715b659185 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 11 Aug 2021 01:01:04 -0400 Subject: [PATCH 04/15] Update welcome_msg_v3.md --- .../homebrew/pages/homePage/welcome_msg_v3.md | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/client/homebrew/pages/homePage/welcome_msg_v3.md b/client/homebrew/pages/homePage/welcome_msg_v3.md index 6377e934c..9a5294f81 100644 --- a/client/homebrew/pages/homePage/welcome_msg_v3.md +++ b/client/homebrew/pages/homePage/welcome_msg_v3.md @@ -12,7 +12,7 @@ Welcome traveler from an antique land. Please sit and tell us of what you have s ### Homebrew D&D made easy The Homebrewery makes the creation and sharing of authentic looking Fifth-Edition homebrews easy. It uses [Markdown](https://help.github.com/articles/markdown-basics/) with a little CSS magic to make your brews come to life. -**Try it!** Simply edit the text on the left and watch it *update live* on the right. +**Try it!** Simply edit the text on the left and watch it *update live* on the right. Note that not every button is visible on this demo page. Click New {{fas,fa-plus-square}} in the navbar above to start brewing with all the features! ### Editing and Sharing When you create your own homebrew, you will be given a *edit url* and a *share url*. @@ -27,11 +27,11 @@ PDF Printing works best in Google Chrome. If you are having quality/consistency 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 +* If you are printing on A4 paper, make sure to have the {{far,fa-file}} **A4 Pagesize** 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 +If you want to save ink or have a monochrome printer, add the {{fas,fa-tint}} **Ink Friendly** snippet to your brew before you print @@ -55,12 +55,12 @@ This tool will **always** be free, never have ads, and I will never offer any "p ### Bugs, Issues, Suggestions? Need help getting started or just the right look for your brew? Head to [r/Homebrewery](https://www.reddit.com/r/homebrewery/submit?selftext=true&title=%5BIssue%5D%20Describe%20Your%20Issue%20Here) and let us know! -Have an idea of how to make The Homebrewery better? Or did you find something that wasn't quite right? Check out the [GitHub Repo](https://github.com/naturalcrit/homebrewery/) to report technical issues. +Have an idea to make The Homebrewery better? Or did you find something that wasn't quite right? Check out the [GitHub Repo](https://github.com/naturalcrit/homebrewery/) to report technical issues. ### Legal Junk -The Homebrewery is licensed using the [MIT License](https://github.com/naturalcrit/homebrewery/blob/master/license). Which means you are free to use The Homebrewery any way that you want, except for claiming that you made it yourself. +The Homebrewery is licensed using the [MIT License](https://github.com/naturalcrit/homebrewery/blob/master/license). Which means you are free to use The Homebrewery codebase any way that you want, except for claiming that you made it yourself. If you wish to sell or in some way gain profit for what's created on this site, it's your responsibility to ensure you have the proper licenses/rights for any images or resources used. @@ -83,32 +83,37 @@ If you are looking for more 5e Homebrew resources check out [r/UnearthedArcana]( \page ## Markdown+ -Homebrewery aims to make homebrewering as simple as possible, providing a live editor in combination with Markdown syntax for formatting. +The Homebrewery aims to make homebrewing as simple as possible, providing a live editor with Markdown syntax that is more human-readable and faster to write with than raw HTML. -In version 3.0.0, with a goal of retaining maximum flexibility while elmininating the need for any HTML in a brew, Homebrewery has developed additional Markdown-like syntax. +In version 3.0.0, with a goal of adding maximum flexibility without users resorting to complex HTML to accomplish simple tasks, Homebrewery provides an extended verision of Markdown with additional syntax. {{text-align:center -**You must enable v3 via the metadata editor!** +**You can enable V3 via the {{fa,fa-info-circle}} **Properties** button!** }} ### Curly Brackets -The biggest change in version 3 is the replacement of `` and `
` with `{{ }}`. Inline spans and block elements can be created and given ID's and Classes, as well as css properties, each of which are comma separated with no spaces. Spans and Blocks start the same: +The biggest change in V3 is the replacement of `` and `
` with `{{ }}` for a cleaner custom formatting. Inline spans and block elements can be created and given ID's and Classes, as well as css properties, each of which are comma separated with no spaces. Use double quotes if a value requires spaces. Spans and Blocks start the same: #### Span -My favorite author is {{pen,#author,color:orange,font-family:"trebuchet ms" Brandon Sanderson}}. The orange text is given a class of `pen`, and id of `author`, colored orange, and given a new font. +My favorite author is {{pen,#author,color:orange,font-family:"trebuchet ms" Brandon Sanderson}}. The orange text is given a class of `pen`, and id of `author`, colored orange, and given a new font. Note that the first space outside of quotes marks the beginning of the content. #### Block {{purple,#book,background:#aa88aa55,text-align:center -My favorite book is Wheel of Time. This block has a class of `purple`, an id of `book`, and has been styled with a purple background and centered text. +My favorite book is Wheel of Time. This block has a class of `purple`, an id of `book`, and has been styled with a purple background and centered text. Note that the opening and curly brackets are on their own lines without any other contents. }} #### Injection -For any element that is not inside a span or block, you can *inject* attributes using the same syntax but with single brackets immediately after the element. Below, a width and border are set for an image: +For any element not inside a span or block, you can *inject* attributes using the same syntax but with single brackets in a single line immediately after the element. -![alt-text](https://s-media-cache-ak0.pinimg.com/736x/4a/81/79/4a8179462cfdf39054a418efd4cb743e.jpg) {width:100px,border:"2px solid",border-radius:10px} +Inline elements like *italics* {color:#D35400} or images require the injection on the same line. + +Block elements like headers require injection starting on the line immediately following. + +##### A Purple Header +{color:purple} \* *this does not currently work for tables yet* @@ -122,16 +127,12 @@ Much nicer than `




` ### Definition Lists V3 uses HTML *definition lists* to create "lists" with hanging indents. - -**Condition Immunities** :: Here is some text that is long and overflows into a second line, creating a "hanging indent". -**Senses** :: Here is some text that is long and overflows into a second line, creating a "hanging indent". - - +**Senses** :: Here is some text that is long and overflows into a second line, creating a "hanging indent". \column ### Tables -New in v3.0.0 is the option to add column & row spanning between cells. You can see a working example in the updated Class Table Snippet, but a simplified example is given below. +Tables now allow column & row spanning between cells. This is included in some updated snippets, but a simplified example is given below. A cell can be spanned across columns by bunching pipe `|` characters together. @@ -156,7 +157,7 @@ Images must be hosted online somewhere, like [Imgur](https://www.imgur.com). You Using *Curly Injection* you can assign an id, classes, or specific inline CSS properties to the image. -::: +![alt-text](https://s-media-cache-ak0.pinimg.com/736x/4a/81/79/4a8179462cfdf39054a418efd4cb743e.jpg) {width:100px,border:"2px solid",border-radius:10px} \* *When using Imgur-hosted images, use the "direct link", which can be found when you click into your image in the Imgur interace.* From 69a69bbb82e897839c146c85aad75c99c67ec258 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Wed, 11 Aug 2021 21:44:39 -0500 Subject: [PATCH 05/15] Add 'editor' property to snippets.js Add another property to the snippet groups, "editor", with values either "text" or "style". --- client/homebrew/editor/snippetbar/snippets/snippets.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index 6e26ab9ee..ad8dc2750 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -14,6 +14,7 @@ module.exports = [ { groupName : 'Editor', icon : 'fas fa-pencil-alt', + editor : 'text', snippets : [ { name : 'Column Break', @@ -129,6 +130,7 @@ module.exports = [ { groupName : 'PHB', icon : 'fas fa-book', + editor : 'text', snippets : [ { name : 'Spell', @@ -208,6 +210,7 @@ module.exports = [ { groupName : 'Tables', icon : 'fas fa-table', + editor : 'text', snippets : [ { name : 'Class Table', @@ -290,6 +293,7 @@ module.exports = [ { groupName : 'Page', icon : 'fas fa-print', + editor : 'style', snippets : [ { name : 'A4 Page Size', From 3d9f8ea142f4fb5d622f550a3633a5aaeeb506ff Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 06:01:48 -0500 Subject: [PATCH 06/15] Update snippet.js 'editor' to 'view' Change new property 'editor' to 'view' on @calculuschild 's recommendation. --- client/homebrew/editor/snippetbar/snippets/snippets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index ad8dc2750..8f608a614 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -14,7 +14,7 @@ module.exports = [ { groupName : 'Editor', icon : 'fas fa-pencil-alt', - editor : 'text', + view : 'text', snippets : [ { name : 'Column Break', @@ -130,7 +130,7 @@ module.exports = [ { groupName : 'PHB', icon : 'fas fa-book', - editor : 'text', + view : 'text', snippets : [ { name : 'Spell', @@ -210,7 +210,7 @@ module.exports = [ { groupName : 'Tables', icon : 'fas fa-table', - editor : 'text', + view : 'text', snippets : [ { name : 'Class Table', @@ -293,7 +293,7 @@ module.exports = [ { groupName : 'Page', icon : 'fas fa-print', - editor : 'style', + view : 'style', snippets : [ { name : 'A4 Page Size', From 3545bdc5868dcda1b9014ce3e17bc550e7794cb3 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 06:59:55 -0500 Subject: [PATCH 07/15] Update snippetbar.jsx with filter for editor/view specific menus Add logic to filter available snippet menus based on the view/editor that is open ("text" vs "style") for both Legacy and v3. --- .../homebrew/editor/snippetbar/snippetbar.jsx | 24 +++++++++++++++---- .../snippetbar/snippetsLegacy/snippets.js | 4 ++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 0c054b12b..560786344 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -39,12 +39,26 @@ const Snippetbar = createClass({ renderSnippetGroups : function(){ let snippets = []; - if(this.props.view === 'text') { - if(this.props.renderer === 'V3') - snippets = SnippetsV3; + + if(this.props.renderer === 'V3') + if(this.props.view === 'text') { + snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'text'); + } + else if(this.props.view === 'style') { + snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'style'); + } else - snippets = SnippetsLegacy; - } + snippets = null + else + if(this.props.view === 'text') { + snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'text'); + } + else if(this.props.view === 'style') { + snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'style'); + } + else + snippets = null + return _.map(snippets, (snippetGroup)=>{ return Date: Thu, 12 Aug 2021 07:00:51 -0500 Subject: [PATCH 08/15] Change 'print' to 'page' on Legacy snippet.js Tiny fix to change "Print" menu to "Page" menu on Legacy. --- client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js index d497148e3..b66430dbb 100644 --- a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js +++ b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js @@ -266,7 +266,7 @@ module.exports = [ /**************** PRINT *************/ { - groupName : 'Print', + groupName : 'Page', icon : 'fas fa-print', view : 'style', snippets : [ From 807f865d8b1ea88db7c640eb201f05993e32f2eb Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 07:42:08 -0500 Subject: [PATCH 09/15] Match Legacy snippets to v3, remove ' + gen : ['/* A4 Page Size */', + '.phb{', + ' width : 210mm;', + ' height : 296.8mm;', + '}', + '' ].join('\n') }, { name : 'Square Page Size', icon : 'far fa-file', - gen : ['' + gen : ['/* Square Page Size */', + '.page {', + ' width:5.25in;', + ' height:5.25in;', + ' padding:.5in;', + ' columns:unset;', + '}', + '' ].join('\n') }, { name : 'Ink Friendly', icon : 'fas fa-tint', - gen : ['', + gen : ['/* Ink Friendly */', + '.pages *:is(.page,.monster,.note,.descriptive) {', + ' background:white !important;', + ' box-shadow:0px 0px 3px !important;', + '}', + '', + '.page .note:before {', + ' box-shadow:0px 0px 3px;', + '}', '' ].join('\n') }, diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js index b66430dbb..5015d371a 100644 --- a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js +++ b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js @@ -271,24 +271,36 @@ module.exports = [ view : 'style', snippets : [ { - name : 'A4 PageSize', + name : 'A4 Page Size', icon : 'far fa-file', - gen : ['' + '}' + ].join('\n') + }, + { + name : 'Square Page Size', + icon : 'far fa-file', + gen : ['/* Square Page Size */', + '.phb {', + ' width:5.25in;', + ' height:5.25in;', + ' padding:.5in;', + ' columns:unset;', + '}', + '' ].join('\n') }, { name : 'Ink Friendly', icon : 'fas fa-tint', - gen : ['', + gen : ['/* Ink Friendly */', + '.phb, .phb blockquote, .phb hr+blockquote {', + ' background : white;', + ' box-shadow : 0px 0px 3px;', + '}', '' ].join('\n') }, From 562bf6d4ac29ecff79b9d233dbc0c5292c8c68bd Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 07:45:00 -0500 Subject: [PATCH 10/15] Fix to snippets.js both legacy and v3 for CircleCI --- client/homebrew/editor/snippetbar/snippets/snippets.js | 8 ++++---- .../homebrew/editor/snippetbar/snippetsLegacy/snippets.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index 39f28133c..a4c47d765 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -14,7 +14,7 @@ module.exports = [ { groupName : 'Editor', icon : 'fas fa-pencil-alt', - view : 'text', + view : 'text', snippets : [ { name : 'Column Break', @@ -130,7 +130,7 @@ module.exports = [ { groupName : 'PHB', icon : 'fas fa-book', - view : 'text', + view : 'text', snippets : [ { name : 'Spell', @@ -210,7 +210,7 @@ module.exports = [ { groupName : 'Tables', icon : 'fas fa-table', - view : 'text', + view : 'text', snippets : [ { name : 'Class Table', @@ -293,7 +293,7 @@ module.exports = [ { groupName : 'Page', icon : 'fas fa-print', - view : 'style', + view : 'style', snippets : [ { name : 'A4 Page Size', diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js index 5015d371a..b9cf865a9 100644 --- a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js +++ b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js @@ -13,7 +13,7 @@ module.exports = [ { groupName : 'Editor', icon : 'fas fa-pencil-alt', - view : 'text', + view : 'text', snippets : [ { name : 'Column Break', @@ -115,7 +115,7 @@ module.exports = [ { groupName : 'PHB', icon : 'fas fa-book', - view : 'text', + view : 'text', snippets : [ { name : 'Spell', @@ -183,7 +183,7 @@ module.exports = [ { groupName : 'Tables', icon : 'fas fa-table', - view : 'text', + view : 'text', snippets : [ { name : 'Class Table', @@ -268,7 +268,7 @@ module.exports = [ { groupName : 'Page', icon : 'fas fa-print', - view : 'style', + view : 'style', snippets : [ { name : 'A4 Page Size', From 88c485ffe5934c44e16b668baf0df0473ee25411 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:10:13 -0500 Subject: [PATCH 11/15] circleCI fix hopefully last one.. circleCI fixes circleCI fixes --- .../homebrew/editor/snippetbar/snippetbar.jsx | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 560786344..5302a339b 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -39,26 +39,20 @@ const Snippetbar = createClass({ renderSnippetGroups : function(){ let snippets = []; - if(this.props.renderer === 'V3') if(this.props.view === 'text') { - snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'text'); - } - else if(this.props.view === 'style') { - snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'style'); - } - else - snippets = null + snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'text'); + } else if(this.props.view === 'style') { + snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'style'); + } else + snippets = null; else - if(this.props.view === 'text') { - snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'text'); - } - else if(this.props.view === 'style') { - snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'style'); - } - else - snippets = null - + if(this.props.view === 'text') { + snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'text'); + } else if(this.props.view === 'style') { + snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'style'); + } else + snippets = null; return _.map(snippets, (snippetGroup)=>{ return Date: Sun, 15 Aug 2021 00:45:01 -0400 Subject: [PATCH 12/15] Refactoring switching logic, formatting LESS --- .../homebrew/editor/snippetbar/snippetbar.jsx | 14 +------ .../editor/snippetbar/snippets/snippets.js | 39 ++++++++++--------- .../snippetbar/snippetsLegacy/snippets.js | 33 +++++++++------- 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 5302a339b..9ea04695f 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -40,19 +40,9 @@ const Snippetbar = createClass({ let snippets = []; if(this.props.renderer === 'V3') - if(this.props.view === 'text') { - snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'text'); - } else if(this.props.view === 'style') { - snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'style'); - } else - snippets = null; + snippets = SnippetsV3.filter((snippetGroup)=>snippetGroup.view === this.props.view); else - if(this.props.view === 'text') { - snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'text'); - } else if(this.props.view === 'style') { - snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'style'); - } else - snippets = null; + snippets = SnippetsLegacy.filter((snippetGroup)=>snippetGroup.view === this.props.view); return _.map(snippets, (snippetGroup)=>{ return Date: Sun, 15 Aug 2021 00:51:22 -0400 Subject: [PATCH 13/15] Lint --- server.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server.js b/server.js index d0d7b351d..281a0477d 100644 --- a/server.js +++ b/server.js @@ -45,14 +45,14 @@ const sanitizeBrew = (brew, full=false)=>{ return brew; }; -const splitTextAndStyle = (brew) => { - brew.text = brew.text.replaceAll('\r\n','\n'); +const splitTextAndStyle = (brew)=>{ + brew.text = brew.text.replaceAll('\r\n', '\n'); if(brew.text.startsWith('```css')) { const index = brew.text.indexOf('```\n\n'); brew.style = brew.text.slice(7, index - 1); brew.text = brew.text.slice(index + 5); } -} +}; app.use('/', serveCompressedStaticAssets(`${__dirname}/build`)); @@ -101,7 +101,7 @@ app.use(require('./server/admin.api.js')); const HomebrewModel = require('./server/homebrew.model.js').model; const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8'); -const welcomeText_v3 = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg_v3.md', 'utf8'); +const welcomeTextV3 = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg_v3.md', 'utf8'); const changelogText = require('fs').readFileSync('./changelog.md', 'utf8'); String.prototype.replaceAll = function(s, r){return this.split(s).join(r);}; @@ -123,7 +123,7 @@ app.get('/', async (req, res, next)=>{ //Home page v3 app.get('/v3_preview', async (req, res, next)=>{ const brew = { - text : welcomeText_v3, + text : welcomeTextV3, renderer : 'V3' }; splitTextAndStyle(brew); From 7977e869c3df30f804360847d7cde8c9e28e879f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 16 Aug 2021 00:52:34 -0400 Subject: [PATCH 14/15] Small tweaks. Move "Create your own" button slightly. --- client/homebrew/pages/homePage/homePage.less | 6 ++-- .../homebrew/pages/homePage/welcome_msg_v3.md | 28 +++++++++++-------- server.js | 2 +- themes/5ePhb.style.less | 5 +++- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/client/homebrew/pages/homePage/homePage.less b/client/homebrew/pages/homePage/homePage.less index 37b412282..719e89f22 100644 --- a/client/homebrew/pages/homePage/homePage.less +++ b/client/homebrew/pages/homePage/homePage.less @@ -5,7 +5,7 @@ position : absolute; display : block; right : 70px; - bottom : 70px; + bottom : 50px; z-index : 100; z-index : 5001; padding : 1em; @@ -23,7 +23,7 @@ position : absolute; display : block; right : 200px; - bottom : 90px; + bottom : 70px; z-index : 100; z-index : 5000; padding : 0.8em; @@ -40,4 +40,4 @@ right : 350px; } } -} \ No newline at end of file +} diff --git a/client/homebrew/pages/homePage/welcome_msg_v3.md b/client/homebrew/pages/homePage/welcome_msg_v3.md index 9a5294f81..471932ed1 100644 --- a/client/homebrew/pages/homePage/welcome_msg_v3.md +++ b/client/homebrew/pages/homePage/welcome_msg_v3.md @@ -3,6 +3,10 @@ border:1px dashed #00000030; } +.page { + padding-bottom : 1.6cm; +} + ``` @@ -86,22 +90,19 @@ If you are looking for more 5e Homebrew resources check out [r/UnearthedArcana]( The Homebrewery aims to make homebrewing as simple as possible, providing a live editor with Markdown syntax that is more human-readable and faster to write with than raw HTML. In version 3.0.0, with a goal of adding maximum flexibility without users resorting to complex HTML to accomplish simple tasks, Homebrewery provides an extended verision of Markdown with additional syntax. - -{{text-align:center -**You can enable V3 via the {{fa,fa-info-circle}} **Properties** button!** -}} +**You can enable V3 via the {{fa,fa-info-circle}} Properties button!** ### Curly Brackets The biggest change in V3 is the replacement of `` and `
` with `{{ }}` for a cleaner custom formatting. Inline spans and block elements can be created and given ID's and Classes, as well as css properties, each of which are comma separated with no spaces. Use double quotes if a value requires spaces. Spans and Blocks start the same: #### Span -My favorite author is {{pen,#author,color:orange,font-family:"trebuchet ms" Brandon Sanderson}}. The orange text is given a class of `pen`, and id of `author`, colored orange, and given a new font. Note that the first space outside of quotes marks the beginning of the content. +My favorite author is {{pen,#author,color:orange,font-family:"trebuchet ms" Brandon Sanderson}}. The orange text has a class of `pen`, an id of `author`, is colored orange, and given a new font. The first space outside of quotes marks the beginning of the content. #### Block -{{purple,#book,background:#aa88aa55,text-align:center -My favorite book is Wheel of Time. This block has a class of `purple`, an id of `book`, and has been styled with a purple background and centered text. Note that the opening and curly brackets are on their own lines without any other contents. +{{purple,#book,text-align:center,background:#aa88aa55 +My favorite book is Wheel of Time. This block has a class of `purple`, an id of `book`, and centered text with a colored background. The opening and closing brackets are on lines separate from the block contents. }} @@ -110,15 +111,15 @@ For any element not inside a span or block, you can *inject* attributes using th Inline elements like *italics* {color:#D35400} or images require the injection on the same line. -Block elements like headers require injection starting on the line immediately following. +Block elements like headers require the injection to start on the line immediately following. ##### A Purple Header -{color:purple} +{color:purple,text-align:center} \* *this does not currently work for tables yet* ### Vertical Spacing -The HTML tag `
` has been replaced by either a single `:` along on a line, or multiple `:` on the same line. +A blank line can be achieved with a run of one or more `:` alone on a line. More `:`'s will create more space. :: @@ -129,12 +130,15 @@ V3 uses HTML *definition lists* to create "lists" with hanging indents. **Senses** :: Here is some text that is long and overflows into a second line, creating a "hanging indent". +### Column Breaks +Column and page breaks with `\column` and `\page`. + \column ### Tables Tables now allow column & row spanning between cells. This is included in some updated snippets, but a simplified example is given below. -A cell can be spanned across columns by bunching pipe `|` characters together. +A cell can be spanned across columns by grouping multiple pipe `|` characters at the end of a cell. Row spanning is achieved by adding a `^` at the end of a cell just before the `|`. @@ -167,7 +171,7 @@ Homebrewery comes with a series of *code snippets* found at the top of the edito ## Style Editor Panel -{{fa,fa-paint-brush}}Also, technically released prior to v3 but still new to many users, check out the new **Style Editor** located on the right side of the Snippet bar. This editor excepts CSS for styling without requiring `