diff --git a/.eslintrc.js b/.eslintrc.js
index dd4bcd0d3..74e7bb660 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -15,7 +15,7 @@ module.exports = {
rules : {
/** Errors **/
'camelcase' : ['error', { properties: 'never' }],
- 'func-style' : ['error', 'expression', { allowArrowFunctions: true }],
+ //'func-style' : ['error', 'expression', { allowArrowFunctions: true }],
'no-array-constructor' : 'error',
'no-iterator' : 'error',
'no-nested-ternary' : 'error',
diff --git a/.stylelintrc.json b/.stylelintrc.json
new file mode 100644
index 000000000..207dfda62
--- /dev/null
+++ b/.stylelintrc.json
@@ -0,0 +1,48 @@
+{
+ "extends": [
+ "stylelint-config-recess-order",
+ "stylelint-config-recommended"],
+ "plugins": [
+ "stylelint-stylistic",
+ "./stylelint_plugins/declaration-colon-align.js",
+ "./stylelint_plugins/declaration-colon-min-space-before",
+ "./stylelint_plugins/declaration-block-multi-line-min-declarations"
+ ],
+ "customSyntax": "postcss-less",
+ "rules": {
+ "no-descending-specificity" : null,
+ "at-rule-no-unknown" : null,
+ "function-no-unknown" : null,
+ "font-family-no-missing-generic-family-keyword" : null,
+ "font-weight-notation" : "named-where-possible",
+ "font-family-name-quotes" : "always-unless-keyword",
+ "stylistic/indentation" : "tab",
+ "no-duplicate-selectors" : true,
+ "stylistic/color-hex-case" : "upper",
+ "color-hex-length" : "long",
+ "stylistic/selector-combinator-space-after" : "always",
+ "stylistic/selector-combinator-space-before" : "always",
+ "stylistic/selector-attribute-operator-space-before" : "never",
+ "stylistic/selector-attribute-operator-space-after" : "never",
+ "stylistic/selector-attribute-brackets-space-inside" : "never",
+ "selector-attribute-quotes" : "always",
+ "selector-pseudo-element-colon-notation" : "double",
+ "stylistic/selector-pseudo-class-parentheses-space-inside" : "never",
+ "stylistic/block-opening-brace-space-before" : "always",
+ "naturalcrit/declaration-colon-min-space-before" : 1,
+ "stylistic/declaration-block-trailing-semicolon" : "always",
+ "stylistic/declaration-colon-space-after" : "always",
+ "stylistic/number-leading-zero" : "always",
+ "function-url-quotes" : ["always", { "except": ["empty"] }],
+ "function-url-scheme-disallowed-list" : ["data","http"],
+ "comment-whitespace-inside" : "always",
+ "stylistic/string-quotes" : "single",
+ "stylistic/media-feature-range-operator-space-before" : "always",
+ "stylistic/media-feature-range-operator-space-after" : "always",
+ "stylistic/media-feature-parentheses-space-inside" : "never",
+ "stylistic/media-feature-colon-space-before" : "always",
+ "stylistic/media-feature-colon-space-after" : "always",
+ "naturalcrit/declaration-colon-align" : true,
+ "naturalcrit/declaration-block-multi-line-min-declarations": 1
+ }
+}
diff --git a/Dockerfile b/Dockerfile
index 1b9127e1b..82b13ac86 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:16.13-alpine
+FROM node:18-alpine
RUN apk --no-cache add git
ENV NODE_ENV=docker
@@ -10,11 +10,11 @@ WORKDIR /usr/src/app
# This improves caching so we don't have to download the dependencies every time the code changes
COPY package.json ./
# --ignore-scripts tells yarn not to run postbuild. We run it explicitly later
-RUN yarn install --ignore-scripts
+RUN npm install --ignore-scripts
# Bundle app source and build application
COPY . .
-RUN yarn build
+RUN npm run build
EXPOSE 8000
-CMD [ "yarn", "start" ]
+CMD [ "npm", "start" ]
diff --git a/changelog.md b/changelog.md
index c40aa625b..040680ce6 100644
--- a/changelog.md
+++ b/changelog.md
@@ -80,6 +80,50 @@ pre {
## changelog
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
+### Wednesday 28/06/2023 - v3.9.1
+{{taskList
+
+##### G-Ambatte
+
+* [x] Better error pages with more useful information
+
+Fixes issue [#1924](https://github.com/naturalcrit/homebrewery/issues/1924)
+}}
+
+### Friday 02/06/2023 - v3.9.0
+{{taskList
+
+##### Calculuschild
+
+* [x] Fix some files not showing up on userpage when user has a large number of brews in Google Drive
+
+Fixes issue [#2408](https://github.com/naturalcrit/homebrewery/issues/2408)
+
+* [x] Pressing tab now indents with spaces instead of tab character; fixes several issues with Markdown lists
+
+Fixes issues [#2092](https://github.com/naturalcrit/homebrewery/issues/2092), [#1556](https://github.com/naturalcrit/homebrewery/issues/1556)
+
+* [x] Rename `naturalCritLogo.svg` to `naturalCritLogoRed.svg`. Those using the {{beta BETA}} coverPage snippet may need to update that text to make the NaturalCrit logo appear again.
+
+##### G-Ambatte
+
+* [x] Fix strange animation of image masks
+
+Fixes issue [#2790](https://github.com/naturalcrit/homebrewery/issues/2790)
+
+##### 5e-Cleric
+
+* [x] New {{openSans **PHB → {{fac,book-part-cover}} PART COVER PAGE** }} snippet for V3!
+
+* [x] New {{openSans **PHB → {{fac,book-back-cover}} BACK COVER PAGE** }} snippet for V3! (Thanks to /u/Kaiburr_Kath-Hound on Reddit for providing some of these resources!)
+
+* [x] New {{openSans **TEXT EDITOR → {{fas,fa-bars}} INDEX** }} snippet for V3!
+
+* [x] Fix highlighting of curly braces inside comments
+
+Fixes issue [#2784](https://github.com/naturalcrit/homebrewery/issues/2784)
+}}
+
### Wednesday 12/04/2023 - v3.8.0
{{taskList
@@ -101,7 +145,7 @@ Fixes issue [#2595](https://github.com/naturalcrit/homebrewery/issues/2595)
Fixes issues [#2657](https://github.com/naturalcrit/homebrewery/issues/2657)
-* [x] Fix internal links inside `
` blocks not receiving the `target=_self` attribute
+* [x] Fix internal links inside `<\div>` blocks not receiving the `target=_self` attribute
Fixes issues [#2680](https://github.com/naturalcrit/homebrewery/issues/2680)
@@ -111,7 +155,7 @@ Fixes issues [#1679](https://github.com/naturalcrit/homebrewery/issues/1679)
* [x] Add local Windows install script via Chocolatey
-##### 5e-Clerc
+##### 5e-Cleric
* [x] New {{openSans **TABLES → {{fas,fa-language}} RUNE TABLE**}} snippets for V3. Adds an alphabetic script translation table.
diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx
index 27fef7e16..4e5fa3526 100644
--- a/client/homebrew/brewRenderer/brewRenderer.jsx
+++ b/client/homebrew/brewRenderer/brewRenderer.jsx
@@ -108,6 +108,12 @@ const BrewRenderer = createClass({
return false;
},
+ sanitizeScriptTags : function(content) {
+ return content
+ .replace(/';
- const rendered = Markdown.render(source);
- expect(rendered).toMatch('<script></script>');
-});
-
test('Processes the markdown within an HTML block if its just a class wrapper', function() {
const source = '
*Bold text*
';
const rendered = Markdown.render(source);
diff --git a/themes/Legacy/5ePHB/snippets/tableOfContents.gen.js b/themes/Legacy/5ePHB/snippets/tableOfContents.gen.js
index 4082ac4ef..40d64af22 100644
--- a/themes/Legacy/5ePHB/snippets/tableOfContents.gen.js
+++ b/themes/Legacy/5ePHB/snippets/tableOfContents.gen.js
@@ -47,8 +47,8 @@ const getTOC = (pages)=>{
return res;
};
-module.exports = function(brew){
- const pages = brew.text.split('\\page');
+module.exports = function(props){
+ const pages = props.brew.text.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/themes/V3/5eDMG/style.less b/themes/V3/5eDMG/style.less
index b9160318b..589e28d63 100644
--- a/themes/V3/5eDMG/style.less
+++ b/themes/V3/5eDMG/style.less
@@ -1,3 +1,5 @@
+@import (less) './themes/assets/assets.less';
+
:root {
//Colors
--HB_Color_Accent : #EBCEC3; // Salmon
@@ -22,3 +24,10 @@
bottom : 40px;
}
}
+
+.page:has(.partCover) {
+
+ .partCover {
+ background-image: @partCoverHeaderDMG;
+ }
+}
\ No newline at end of file
diff --git a/themes/V3/5ePHB/snippets.js b/themes/V3/5ePHB/snippets.js
index d9c574723..c0933d70d 100644
--- a/themes/V3/5ePHB/snippets.js
+++ b/themes/V3/5ePHB/snippets.js
@@ -7,6 +7,7 @@ const scriptGen = require('./snippets/script.gen.js');
const ClassFeatureGen = require('./snippets/classfeature.gen.js');
const CoverPageGen = require('./snippets/coverpage.gen.js');
const TableOfContentsGen = require('./snippets/tableOfContents.gen.js');
+const indexGen = require('./snippets/index.gen.js');
const QuoteGen = require('./snippets/quote.gen.js');
const dedent = require('dedent-tabs').default;
@@ -19,20 +20,16 @@ module.exports = [
icon : 'fas fa-pencil-alt',
view : 'text',
snippets : [
- {
- name : 'Page Number',
- icon : 'fas fa-bookmark',
- gen : '{{pageNumber 1}}\n{{footnote PART 1 | SECTION NAME}}\n\n'
- },
- {
- name : 'Auto-incrementing Page Number',
- icon : 'fas fa-sort-numeric-down',
- gen : '{{pageNumber,auto}}\n{{footnote PART 1 | SECTION NAME}}\n\n'
- },
{
name : 'Table of Contents',
icon : 'fas fa-book',
gen : TableOfContentsGen
+ },
+ {
+ name : 'Index',
+ icon : 'fas fa-bars',
+ gen : indexGen,
+ experimental : true
}
]
},
@@ -187,6 +184,18 @@ module.exports = [
gen : CoverPageGen.inside,
experimental : true
},
+ {
+ name : 'Part Cover Page',
+ icon : 'fac book-part-cover',
+ gen : CoverPageGen.part,
+ experimental : true
+ },
+ {
+ name : 'Back Cover Page',
+ icon : 'fac book-back-cover',
+ gen : CoverPageGen.back,
+ experimental : true
+ },
{
name : 'Magic Item',
icon : 'fas fa-hat-wizard',
@@ -203,7 +212,7 @@ module.exports = [
}}
\n`;
},
- },
+ }
]
},
@@ -217,34 +226,51 @@ module.exports = [
view : 'text',
snippets : [
{
- name : 'Class Table',
- icon : 'fas fa-table',
- gen : ClassTableGen.full('classTable,frame,decoration,wide'),
- },
- {
- name : 'Class Table (unframed)',
- icon : 'fas fa-border-none',
- gen : ClassTableGen.full('classTable,wide'),
- },
- {
- name : '1/2 Class Table',
- icon : 'fas fa-list-alt',
- gen : ClassTableGen.half('classTable,decoration,frame'),
- },
- {
- name : '1/2 Class Table (unframed)',
- icon : 'fas fa-border-none',
- gen : ClassTableGen.half('classTable'),
- },
- {
- name : '1/3 Class Table',
- icon : 'fas fa-border-all',
- gen : ClassTableGen.third('classTable,frame'),
- },
- {
- name : '1/3 Class Table (unframed)',
- icon : 'fas fa-border-none',
- gen : ClassTableGen.third('classTable'),
+ name : 'Class Tables',
+ icon : 'fas fa-table',
+ gen : ClassTableGen.full('classTable,frame,decoration,wide'),
+ subsnippets : [
+ {
+ name : 'Martial Class Table',
+ icon : 'fas fa-table',
+ gen : ClassTableGen.non('classTable,frame,decoration'),
+ },
+ {
+ name : 'Martial Class Table (unframed)',
+ icon : 'fas fa-border-none',
+ gen : ClassTableGen.non('classTable'),
+ },
+ {
+ name : 'Full Caster Class Table',
+ icon : 'fas fa-table',
+ gen : ClassTableGen.full('classTable,frame,decoration,wide'),
+ },
+ {
+ name : 'Full Caster Class Table (unframed)',
+ icon : 'fas fa-border-none',
+ gen : ClassTableGen.full('classTable,wide'),
+ },
+ {
+ name : 'Half Caster Class Table',
+ icon : 'fas fa-list-alt',
+ gen : ClassTableGen.half('classTable,frame,decoration,wide'),
+ },
+ {
+ name : 'Half Caster Class Table (unframed)',
+ icon : 'fas fa-border-none',
+ gen : ClassTableGen.half('classTable,wide'),
+ },
+ {
+ name : 'Third Caster Spell Table',
+ icon : 'fas fa-border-all',
+ gen : ClassTableGen.third('classTable,frame,decoration'),
+ },
+ {
+ name : 'Third Caster Spell Table (unframed)',
+ icon : 'fas fa-border-none',
+ gen : ClassTableGen.third('classTable'),
+ }
+ ]
},
{
name : 'Rune Table',
diff --git a/themes/V3/5ePHB/snippets/classtable.gen.js b/themes/V3/5ePHB/snippets/classtable.gen.js
index c1f6254f9..1fdff036f 100644
--- a/themes/V3/5ePHB/snippets/classtable.gen.js
+++ b/themes/V3/5ePHB/snippets/classtable.gen.js
@@ -1,132 +1,138 @@
const _ = require('lodash');
+const dedent = require('dedent-tabs').default;
const features = [
- 'Astrological Botany',
- 'Biochemical Sorcery',
- 'Civil Divination',
- 'Consecrated Augury',
- 'Demonic Anthropology',
- 'Divinatory Mineralogy',
- 'Exo Interfacer',
- 'Genetic Banishing',
- 'Gunpowder Torturer',
- 'Gunslinger Corruptor',
- 'Hermetic Geography',
- 'Immunological Cultist',
- 'Malefic Chemist',
- 'Mathematical Pharmacy',
- 'Nuclear Biochemistry',
- 'Orbital Gravedigger',
- 'Pharmaceutical Outlaw',
- 'Phased Linguist',
- 'Plasma Gunslinger',
- 'Police Necromancer',
- 'Ritual Astronomy',
- 'Sixgun Poisoner',
- 'Seismological Alchemy',
- 'Spiritual Illusionism',
- 'Statistical Occultism',
- 'Spell Analyst',
- 'Torque Interfacer'
+ 'Astrological Botany', 'Biochemical Sorcery', 'Civil Divination',
+ 'Consecrated Augury', 'Demonic Anthropology', 'Divinatory Mineralogy',
+ 'Exo Interfacer', 'Genetic Banishing', 'Gunpowder Torturer',
+ 'Gunslinger Corruptor', 'Hermetic Geography', 'Immunological Cultist',
+ 'Malefic Chemist', 'Mathematical Pharmacy', 'Nuclear Biochemistry',
+ 'Orbital Gravedigger', 'Pharmaceutical Outlaw', 'Phased Linguist',
+ 'Plasma Gunslinger', 'Police Necromancer', 'Ritual Astronomy',
+ 'Sixgun Poisoner', 'Seismological Alchemy', 'Spiritual Illusionism',
+ 'Statistical Occultism', 'Spell Analyst', 'Torque Interfacer'
+].map((f)=>_.padEnd(f, 21)); // Pad to equal length of 21 chars long
+
+const classnames = [
+ 'Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger',
+ 'Haberdasher', 'Manicurist', 'Netrunner', 'Weirkeeper'
];
-const classnames = ['Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger',
- 'Haberdasher', 'Manicurist', 'Netrunner', 'Weirkeeper'];
-
-const levels = ['1st', '2nd', '3rd', '4th', '5th',
- '6th', '7th', '8th', '9th', '10th',
- '11th', '12th', '13th', '14th', '15th',
- '16th', '17th', '18th', '19th', '20th'];
-
-const profBonus = [2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6];
-
-const maxes = [4, 3, 3, 3, 3, 2, 2, 1, 1];
-
-const drawSlots = function(Slots, rows, padding){
- let slots = Number(Slots);
- return _.times(rows, function(i){
- const max = maxes[i];
- if(slots < 1) return _.pad('—', padding);
- const res = _.min([max, slots]);
- slots -= res;
- return _.pad(res.toString(), padding);
- }).join(' | ');
-};
-
module.exports = {
- full : function(classes){
- const classname = _.sample(classnames);
-
-
- let cantrips = 3;
- let spells = 1;
- let slots = 2;
- return `{{${classes}\n##### The ${classname}\n` +
- `| Level | Proficiency | Features | Cantrips | Spells | --- Spell Slots Per Spell Level ---|||||||||\n`+
- `| ^| Bonus ^| ^| Known ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th |\n`+
- `|:-----:|:-----------:|:-------------|:--------:|:------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|\n${
- _.map(levels, function(levelName, level){
- const res = [
- _.pad(levelName, 5),
- _.pad(`+${profBonus[level]}`, 2),
- _.padEnd(_.sample(features), 21),
- _.pad(cantrips.toString(), 8),
- _.pad(spells.toString(), 6),
- drawSlots(slots, 9, 2),
- ].join(' | ');
-
- cantrips += _.random(0, 1);
- spells += _.random(0, 1);
- slots += _.random(0, 2);
-
- return `| ${res} |`;
- }).join('\n')}\n}}\n\n`;
+ non : function(snippetClasses){
+ return dedent`
+ {{${snippetClasses}
+ ##### The ${_.sample(classnames)}
+ | Level | Proficiency Bonus | Features | ${_.sample(features)} |
+ |:-----:|:-----------------:|:---------|:---------------------:|
+ | 1st | +2 | ${_.sample(features)} | 2 |
+ | 2nd | +2 | ${_.sample(features)} | 2 |
+ | 3rd | +2 | ${_.sample(features)} | 3 |
+ | 4th | +2 | ${_.sample(features)} | 3 |
+ | 5th | +3 | ${_.sample(features)} | 3 |
+ | 6th | +3 | ${_.sample(features)} | 4 |
+ | 7th | +3 | ${_.sample(features)} | 4 |
+ | 8th | +3 | ${_.sample(features)} | 4 |
+ | 9th | +4 | ${_.sample(features)} | 4 |
+ | 10th | +4 | ${_.sample(features)} | 4 |
+ | 11th | +4 | ${_.sample(features)} | 4 |
+ | 12th | +4 | ${_.sample(features)} | 5 |
+ | 13th | +5 | ${_.sample(features)} | 5 |
+ | 14th | +5 | ${_.sample(features)} | 5 |
+ | 15th | +5 | ${_.sample(features)} | 5 |
+ | 16th | +5 | ${_.sample(features)} | 5 |
+ | 17th | +6 | ${_.sample(features)} | 6 |
+ | 18th | +6 | ${_.sample(features)} | 6 |
+ | 19th | +6 | ${_.sample(features)} | 6 |
+ | 20th | +6 | ${_.sample(features)} | unlimited |
+ }}\n\n`;
},
- half : function(classes){
- const classname = _.sample(classnames);
-
- let featureScore = 1;
- return `{{${classes}\n##### The ${classname}\n` +
- `| Level | Proficiency Bonus | Features | ${_.pad(_.sample(features), 21)} |\n` +
- `|:-----:|:-----------------:|:---------|:---------------------:|\n${
- _.map(levels, function(levelName, level){
- const res = [
- _.pad(levelName, 5),
- _.pad(`+${profBonus[level]}`, 2),
- _.padEnd(_.sample(features), 23),
- _.pad(`+${featureScore}`, 21),
- ].join(' | ');
-
- featureScore += _.random(0, 1);
-
- return `| ${res} |`;
- }).join('\n')}\n}}\n\n`;
+ full : function(snippetClasses){
+ return dedent`
+ {{${snippetClasses}
+ ##### The ${_.sample(classnames)}
+ | Level | Proficiency | Features | Cantrips | --- Spell Slots Per Spell Level ---|||||||||
+ | ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th |
+ |:-----:|:-----------:|:-------------|:--------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|
+ | 1st | +2 | ${_.sample(features)} | 2 | 2 | — | — | — | — | — | — | — | — |
+ | 2nd | +2 | ${_.sample(features)} | 2 | 3 | — | — | — | — | — | — | — | — |
+ | 3rd | +2 | ${_.sample(features)} | 2 | 4 | 2 | — | — | — | — | — | — | — |
+ | 4th | +2 | ${_.sample(features)} | 3 | 4 | 3 | — | — | — | — | — | — | — |
+ | 5th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 2 | — | — | — | — | — | — |
+ | 6th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | — | — | — | — | — | — |
+ | 7th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 1 | — | — | — | — | — |
+ | 8th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | — | — | — | — | — |
+ | 9th | +4 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | 1 | — | — | — | — |
+ | 10th | +4 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | 1 | — | — | — | — |
+ | 11th | +4 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | — | — | — |
+ | 12th | +4 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | — | — | — |
+ | 13th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — |
+ | 14th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — |
+ | 15th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — |
+ | 16th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — |
+ | 17th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | 1 |
+ | 18th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 1 | 1 | 1 | 1 | 1 |
+ | 19th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 2 | 2 | 1 | 1 | 1 |
+ | 20th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 2 | 2 | 2 | 1 | 1 |
+ }}\n\n`;
},
- third : function(classes){
- const classname = _.sample(classnames);
+ half : function(snippetClasses){
+ return dedent`
+ {{${snippetClasses}
+ ##### The ${_.sample(classnames)}
+ | Level | Proficiency | Features | Spells |--- Spell Slots Per Spell Level ---|||||
+ | ^| Bonus ^| ^| Known ^| 1st | 2nd | 3rd | 4th | 5th |
+ |:-----:|:-----------:|:-------------|:------:|:-----:|:-----:|:-----:|:-----:|:-----:|
+ | 1st | +2 | ${_.sample(features)} | — | — | — | — | — | — |
+ | 2nd | +2 | ${_.sample(features)} | 2 | 2 | — | — | — | — |
+ | 3rd | +2 | ${_.sample(features)} | 3 | 3 | — | — | — | — |
+ | 4th | +2 | ${_.sample(features)} | 3 | 3 | — | — | — | — |
+ | 5th | +3 | ${_.sample(features)} | 4 | 4 | 2 | — | — | — |
+ | 6th | +3 | ${_.sample(features)} | 4 | 4 | 2 | — | — | — |
+ | 7th | +3 | ${_.sample(features)} | 5 | 4 | 3 | — | — | — |
+ | 8th | +3 | ${_.sample(features)} | 5 | 4 | 3 | — | — | — |
+ | 9th | +4 | ${_.sample(features)} | 6 | 4 | 3 | 2 | — | — |
+ | 10th | +4 | ${_.sample(features)} | 6 | 4 | 3 | 2 | — | — |
+ | 11th | +4 | ${_.sample(features)} | 7 | 4 | 3 | 3 | — | — |
+ | 12th | +4 | ${_.sample(features)} | 7 | 4 | 3 | 3 | — | — |
+ | 13th | +5 | ${_.sample(features)} | 8 | 4 | 3 | 3 | 1 | — |
+ | 14th | +5 | ${_.sample(features)} | 8 | 4 | 3 | 3 | 1 | — |
+ | 15th | +5 | ${_.sample(features)} | 9 | 4 | 3 | 3 | 2 | — |
+ | 16th | +5 | ${_.sample(features)} | 9 | 4 | 3 | 3 | 2 | — |
+ | 17th | +6 | ${_.sample(features)} | 10 | 4 | 3 | 3 | 3 | 1 |
+ | 18th | +6 | ${_.sample(features)} | 10 | 4 | 3 | 3 | 3 | 1 |
+ | 19th | +6 | ${_.sample(features)} | 11 | 4 | 3 | 3 | 3 | 2 |
+ | 20th | +6 | ${_.sample(features)} | 11 | 4 | 3 | 3 | 3 | 2 |
+ }}\n\n`;
+ },
- let cantrips = 3;
- let spells = 1;
- let slots = 2;
- return `{{${classes}\n##### ${classname} Spellcasting\n` +
- `| Class | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` +
- `| Level ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` +
- `|:------:|:--------:|:-------:|:-------:|:-------:|:-------:|:-------:|\n${
- _.map(levels, function(levelName, level){
- const res = [
- _.pad(levelName, 6),
- _.pad(cantrips.toString(), 8),
- _.pad(spells.toString(), 7),
- drawSlots(slots, 4, 7),
- ].join(' | ');
-
- cantrips += _.random(0, 1);
- spells += _.random(0, 1);
- slots += _.random(0, 1);
-
- return `| ${res} |`;
- }).join('\n')}\n}}\n\n`;
+ third : function(snippetClasses){
+ return dedent`
+ {{${snippetClasses}
+ ##### ${_.sample(classnames)} Spellcasting
+ | Level | Cantrips | Spells |--- Spells Slots per Spell Level ---||||
+ | ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |
+ |:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:|
+ | 3rd | 2 | 3 | 2 | — | — | — |
+ | 4th | 2 | 4 | 3 | — | — | — |
+ | 5th | 2 | 4 | 3 | — | — | — |
+ | 6th | 2 | 4 | 3 | — | — | — |
+ | 7th | 2 | 5 | 4 | 2 | — | — |
+ | 8th | 2 | 6 | 4 | 2 | — | — |
+ | 9th | 2 | 6 | 4 | 2 | — | — |
+ | 10th | 3 | 7 | 4 | 3 | — | — |
+ | 11th | 3 | 8 | 4 | 3 | — | — |
+ | 12th | 3 | 8 | 4 | 3 | — | — |
+ | 13th | 3 | 9 | 4 | 3 | 2 | — |
+ | 14th | 3 | 10 | 4 | 3 | 2 | — |
+ | 15th | 3 | 10 | 4 | 3 | 2 | — |
+ | 16th | 3 | 11 | 4 | 3 | 3 | — |
+ | 17th | 3 | 11 | 4 | 3 | 3 | — |
+ | 18th | 3 | 11 | 4 | 3 | 3 | — |
+ | 19th | 3 | 12 | 4 | 3 | 3 | 1 |
+ | 20th | 3 | 13 | 4 | 3 | 3 | 1 |
+ }}\n\n`;
}
};
diff --git a/themes/V3/5ePHB/snippets/coverpage.gen.js b/themes/V3/5ePHB/snippets/coverpage.gen.js
index 7f9d0cd2a..865269f92 100644
--- a/themes/V3/5ePHB/snippets/coverpage.gen.js
+++ b/themes/V3/5ePHB/snippets/coverpage.gen.js
@@ -68,13 +68,23 @@ const footnote = [
'In an amazing kingdom, in an age of sorcery and lost souls, eight space pirates quest for freedom.'
];
+const coverText = [
+ 'Embark on a thrilling journey across a vast and varied world, where magic and mystery await you at every turn. Encounter strange creatures and ancient secrets, and forge your own destiny with your choices. The world is yours to shape and explore.',
+ 'Join a band of brave adventurers and set out to explore the unknown lands beyond the horizon. Along the way, you’ll face perilous challenges, make new friends and enemies, and uncover a plot that threatens to destroy everything you hold dear. The fate of the world rests in your hands.',
+ 'Create your own character and enter a realm of endless possibilities, where you can be whoever you want to be. Whether you prefer to fight, sneak, charm, or craft your way through the game, you’ll find a style that suits you. The only limit is your imagination.',
+ 'Experience a rich and immersive story that adapts to your actions and decisions. Every choice you make has consequences, for good or ill. Will you be a hero or a villain? A leader or a follower? A friend or a foe? The choice is yours.',
+ 'Dive into a world of epic fantasy and adventure, where you can explore ancient civilizations, dark dungeons, and hidden secrets. Along the way, you’ll meet colorful characters, collect powerful items, and learn new skills. The more you play, the more you’ll discover.',
+ 'Explore a vast and dynamic world that changes according to your actions. You can shape the environment, influence the politics, and alter the history of the game world. But be careful, as every change has a ripple effect that may have unforeseen consequences.',
+ 'Enter a world of wonder and danger, where you can find allies and enemies among the various races and factions that inhabit it. You can choose to join or oppose any of them, or forge your own path. The game world is alive and responsive to your actions.'
+];
+
module.exports = {
front : function() {
return dedent`
{{frontCover}}
- {{logo }}
+ {{logo }}
# ${_.sample(titles)}
## ${_.sample(subtitles)}
@@ -100,10 +110,46 @@ module.exports = {
___
{{imageMaskCenter${_.random(1, 16)},--offsetX:0%,--offsetY:0%,--rotation:0
- {height:100%}
+ {position:absolute,bottom:0,left:0,height:100%}
}}
- {{logo }}
+ {{logo }}
+
+ \page`;
+ },
+
+ part : function() {
+ return dedent`
+ {{partCover}}
+
+ # PART X
+ ## ${_.sample(subtitles)}
+
+ {{imageMaskEdge${_.random(1, 8)},--offset:10cm,--rotation:180
+ {position:absolute,bottom:0,left:0,height:100%}
+ }}
+
+ \page`;
+ },
+
+ back : function() {
+ return dedent`
+ {{backCover}}
+
+ # ${_.sample(subtitles)}
+
+ ${_.sampleSize(coverText, 3).join('\n:\n')}
+ ___
+
+ For use with any fantasy roleplaying ruleset. Play the best game of your life!
+
+ {position:absolute,bottom:0,left:0,height:100%}
+
+ {{logo
+ 
+
+ Homebrewery.Naturalcrit.com
+ }}
\page`;
}
diff --git a/themes/V3/5ePHB/snippets/index.gen.js b/themes/V3/5ePHB/snippets/index.gen.js
new file mode 100644
index 000000000..8de5df14c
--- /dev/null
+++ b/themes/V3/5ePHB/snippets/index.gen.js
@@ -0,0 +1,85 @@
+const dedent = require('dedent-tabs').default;
+
+module.exports = ()=>{
+ return dedent`
+ {{index,wide,columns:5;
+ ##### Index
+ - Ankhesh-Bort
+ - city map, 7
+ - city watch, 12
+ - guilds, 19
+ - Cheese
+ - types of cheese, 8
+ - cheese-related magic, 14
+ - cheese-related quests, 26-27
+ - Death
+ - appearance, 10
+ - personality, 13
+ - hobbies, 23
+ - Elves
+ - types of elves, 15
+ - elvish magic, 24
+ - elvish curses, 28
+ - Footnotes
+ - types of footnotes, 16-17
+ - footnote rules, 20-21
+ - footnote humor, 29-30
+ - Gods
+ - types of gods, 12
+ - godly interventions, 25
+ - godly conflicts, 31
+ - Heroes
+ - class features, 11-12
+ - heroic deeds, 26-27
+ - Inns
+ - types of inns, 9
+ - inn amenities, 18
+ - Jokes
+ - types of jokes, 11-12
+ - joke delivery, 25
+ - Knives
+ - types of knives, 16-17
+ - knife skills, 22-23
+ - knife fights, 28-29
+ - Luggage
+ - appearance, 10
+ - personality, 13
+ - abilities, 23
+ - Magic
+ - types of magic, 15
+ - magic rules, 24
+ - magic mishaps, 28
+ - Socks
+ - types of socks, 9
+ - sock-related magic (yes, really), 15
+ - sock-related quests (no, really), 26
+ - Trolls
+ - appearance and biology, 11
+ - culture and language, 18
+ - troll rights and activism, 31
+ - Unknown University
+ - history and architecture, 12
+ - faculty and staff, 20
+ - courses and exams, 33
+ - Vampires
+ - types and origins, 13
+ - vampiric powers and weaknesses, 21
+ - vampiric etiquette and politics, 34
+ - Witches
+ - types and traditions, 14
+ - witchcraft and headology, 22
+ - witch trials and tribulations, 35
+ - Xylophones
+ - musical instruments or weapons?, 15
+ - xylophone-related magic and lore, 23
+ - xylophone-related quests and puzzles, 36
+ - Yetis
+ - appearance and behavior, 16
+ - yeti philosophy and religion, 24
+ - yeti encounters and stories, 37
+ - Zombies
+ - types and causes, 17
+ - zombie rights and duties, 25
+ - zombie survival and prevention, 38
+ }}`;
+};
\ No newline at end of file
diff --git a/themes/V3/5ePHB/snippets/tableOfContents.gen.js b/themes/V3/5ePHB/snippets/tableOfContents.gen.js
index 1c52d5cf7..97d82ed40 100644
--- a/themes/V3/5ePHB/snippets/tableOfContents.gen.js
+++ b/themes/V3/5ePHB/snippets/tableOfContents.gen.js
@@ -29,27 +29,29 @@ const getTOC = (pages)=>{
const 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);
- }
- });
+ if(!page.includes("{{frontCover}}") && !page.includes("{{insideCover}}") && !page.includes("{{partCover}}") && !page.includes("{{backCover}}")) {
+ 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 = function(brew){
- const pages = brew.text.split('\\page');
+module.exports = function(props){
+ const pages = props.brew.text.split('\\page');
const TOC = getTOC(pages);
const markdown = _.reduce(TOC, (r, g1, idx1)=>{
if(g1.title !== null) {
diff --git a/themes/V3/5ePHB/style.less b/themes/V3/5ePHB/style.less
index acb6d2f5c..a004a5519 100644
--- a/themes/V3/5ePHB/style.less
+++ b/themes/V3/5ePHB/style.less
@@ -851,6 +851,134 @@ h5 + table{
}
}
}
+//*****************************
+// * BACK COVER
+// *****************************/
+.page:has(.backCover) {
+ color: #fff;
+ columns: 1;
+ padding: 2.25cm 1.3cm 2cm 1.3cm;
+ &:after {
+ all: unset;
+ }
+ .columnWrapper {
+ width: 7.6cm;
+ }
+ .backCover {
+ position: absolute;
+ inset: 0;
+ width: 11cm;
+ background-image: @backCover;
+ background-repeat: no-repeat;
+ background-size: contain;
+ z-index: -1;
+ }
+ .blank {
+ height: 1.4em;
+ }
+ h1 {
+ margin-bottom: .3cm;
+ font-size: 1.35cm;
+ line-height: 0.95em;
+ font-family: NodestoCapsCondensed;
+ text-align: center;
+ color: #ED1C24;
+ }
+ h1+p::first-line,
+ h1+p::first-letter {
+ all: unset;
+ }
+ img {
+ position: absolute;
+ top: 0px;
+ height: 100%;
+ z-index: -2;
+ }
+ hr {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: 1.1cm;
+ height: .53cm;
+ width: 4.5cm;
+ visibility: visible;
+ background-image: @horizontalRule;
+ background-size: 100% 100%;
+ border: none;
+ }
+ p {
+ font-family: Overpass;
+ line-height: 1.5em;
+ font-size: 0.332cm;
+ }
+ hr+p {
+ text-align: center;
+ margin-top: .6cm;
+ }
+ .logo {
+ position: absolute;
+ z-index: 0;
+ height: 1.5cm;
+ left: 1.2cm;
+ bottom: 2cm;
+ width: 7.6cm;
+ img {
+ position: relative;
+ height : 1.5cm;
+ width : 100%;
+ z-index : 0;
+ }
+ p {
+ position: relative;
+ color: #fff;
+ font-family: NodestoCapsWide;
+ font-size: .4cm;
+ letter-spacing: 0.08em;
+ line-height: 1em;
+ text-align: center;
+ text-indent: 0;
+ width: 100%;
+ }
+ }
+}
+
+//*****************************
+ // * PART COVER
+ // *****************************/
+ .page:has(.partCover) {
+ columns : 1;
+ text-align : center;
+ padding-top: 0;
+
+ .partCover {
+ background-image: @partCoverHeaderPHB;
+ background-repeat: no-repeat;
+ position: absolute;
+ background-size: 100%;
+ top: 0;
+ left: 0;
+ height: 6cm;
+ width: 100%;
+ }
+
+ h1 {
+ position: relative;
+ text-align: center;
+ text-transform: uppercase;
+ font-size: 2.3cm;
+ font-family: NodestoCapsCondensed;
+ margin-top: .4cm;
+ }
+
+ h2 {
+ font-family: Overpass;
+ font-size: 0.45cm;
+ position: relative;
+ margin-top: -0.7em;
+ line-height: 1.1em;
+ margin-left : auto;
+ margin-right : auto;
+ }
+ }
//*****************************
// * TABLE OF CONTENTS
@@ -1009,3 +1137,26 @@ break-inside : avoid;
}
}
}
+//*****************************
+// * INDEX
+// *****************************/
+.page {
+ .index {
+ font-size : 0.218cm;
+
+ ul ul {
+ margin : 0;
+ }
+
+ ul {
+ padding-left : 0;
+ text-indent : 0;
+ list-style-type : none;
+ }
+
+ & > ul > li {
+ text-indent : -1.5em;
+ padding-left : 1.5em;
+ }
+ }
+}
diff --git a/themes/V3/Blank/snippets.js b/themes/V3/Blank/snippets.js
index 9d64496c3..72372c297 100644
--- a/themes/V3/Blank/snippets.js
+++ b/themes/V3/Blank/snippets.js
@@ -2,6 +2,7 @@
const WatercolorGen = require('./snippets/watercolor.gen.js');
const ImageMaskGen = require('./snippets/imageMask.gen.js');
+const FooterGen = require('./snippets/footer.gen.js');
const dedent = require('dedent-tabs').default;
module.exports = [
@@ -21,6 +22,53 @@ module.exports = [
icon : 'fas fa-file-alt',
gen : '\n\\page\n'
},
+ {
+ name : 'Page Number',
+ icon : 'fas fa-bookmark',
+ gen : '{{pageNumber 1}}\n'
+ },
+ {
+ name : 'Auto-incrementing Page Number',
+ icon : 'fas fa-sort-numeric-down',
+ gen : '{{pageNumber,auto}}\n'
+ },
+ {
+ name : 'Footer',
+ icon : 'fas fa-shoe-prints',
+ gen : FooterGen.createFooterFunc(),
+ subsnippets : [
+ {
+ name : 'Footer from H1',
+ icon : 'fas fa-dice-one',
+ gen : FooterGen.createFooterFunc(1)
+ },
+ {
+ name : 'Footer from H2',
+ icon : 'fas fa-dice-two',
+ gen : FooterGen.createFooterFunc(2)
+ },
+ {
+ name : 'Footer from H3',
+ icon : 'fas fa-dice-three',
+ gen : FooterGen.createFooterFunc(3)
+ },
+ {
+ name : 'Footer from H4',
+ icon : 'fas fa-dice-four',
+ gen : FooterGen.createFooterFunc(4)
+ },
+ {
+ name : 'Footer from H5',
+ icon : 'fas fa-dice-five',
+ gen : FooterGen.createFooterFunc(5)
+ },
+ {
+ name : 'Footer from H6',
+ icon : 'fas fa-dice-six',
+ gen : FooterGen.createFooterFunc(6)
+ }
+ ]
+ },
{
name : 'Vertical Spacing',
icon : 'fas fa-arrows-alt-v',
diff --git a/themes/V3/Blank/snippets/footer.gen.js b/themes/V3/Blank/snippets/footer.gen.js
new file mode 100644
index 000000000..6583cd06e
--- /dev/null
+++ b/themes/V3/Blank/snippets/footer.gen.js
@@ -0,0 +1,17 @@
+const Markdown = require('../../../../shared/naturalcrit/markdown.js');
+
+module.exports = {
+ createFooterFunc : function(headerSize=1){
+ return (props)=>{
+ const cursorPos = props.cursorPos;
+
+ const markdownText = props.brew.text.split('\n').slice(0, cursorPos.line).join('\n');
+ const markdownTokens = Markdown.marked.lexer(markdownText);
+ const headerToken = markdownTokens.findLast((lexerToken)=>{ return lexerToken.type === 'heading' && lexerToken.depth === headerSize; });
+ const headerText = headerToken?.tokens.map((token)=>{ return token.text; }).join('');
+ const outputText = headerText || 'PART 1 | SECTION NAME';
+
+ return `\n{{footnote ${outputText}}}\n`;
+ };
+ }
+};
\ No newline at end of file
diff --git a/themes/V3/Blank/style.less b/themes/V3/Blank/style.less
index e0d6ba9f7..38aa42f20 100644
--- a/themes/V3/Blank/style.less
+++ b/themes/V3/Blank/style.less
@@ -23,6 +23,9 @@ body {
break-inside : avoid;
display : inline-block;
width : 100%;
+ img {
+ z-index : 0;
+ }
}
.inline-block {
display : inline-block;
@@ -251,7 +254,6 @@ body {
background-size : 20px;
z-index : -1;
transform : translateY(50%) translateX(-50%) rotate(calc(1deg * var(--rotation))) scaleX(var(--scaleX)) scaleY(var(--scaleY));
- transition : transform 2s;
& > p:has(img) {
position : absolute;
width : 50%;
@@ -259,7 +261,6 @@ body {
bottom : 50%;
left : 50%;
transform : translateX(-50%) translateY(50%) rotate(calc(-1deg * var(--rotation))) scaleX(calc(1 / var(--scaleX))) scaleY(calc(1 / var(--scaleY)));
- transition : transform 2s;
}
& img {
position : absolute;
diff --git a/themes/assets/assets.less b/themes/assets/assets.less
index 53863b8c5..cdef32c7c 100644
--- a/themes/assets/assets.less
+++ b/themes/assets/assets.less
@@ -13,7 +13,10 @@
@naturalCritLogo : url('/assets/naturalCritLogo.svg');
@coverPageBanner : url('/assets/coverPageBanner.svg');
@horizontalRule : url('/assets/horizontalRule.svg');
+@partCoverHeaderPHB : url('/assets/partCoverHeaderPHB.png');
+@partCoverHeaderDMG : url('/assets/partCoverHeaderDMG.svg');
@insideCoverMask : url('/assets/insideCoverMask.png');
+@backCover : url('/assets/backCover.png');
@scriptBorder : url('/assets/scriptBorder.png');
// Watercolor Images
diff --git a/themes/assets/backCover.png b/themes/assets/backCover.png
new file mode 100644
index 000000000..5c6a14d25
Binary files /dev/null and b/themes/assets/backCover.png differ
diff --git a/themes/assets/naturalCritLogo.svg b/themes/assets/naturalCritLogoRed.svg
similarity index 100%
rename from themes/assets/naturalCritLogo.svg
rename to themes/assets/naturalCritLogoRed.svg
diff --git a/themes/assets/naturalCritLogoWhite.svg b/themes/assets/naturalCritLogoWhite.svg
new file mode 100644
index 000000000..56b820776
--- /dev/null
+++ b/themes/assets/naturalCritLogoWhite.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/themes/assets/partCoverHeaderDMG.svg b/themes/assets/partCoverHeaderDMG.svg
new file mode 100644
index 000000000..b7defc541
--- /dev/null
+++ b/themes/assets/partCoverHeaderDMG.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/themes/assets/partCoverHeaderPHB.png b/themes/assets/partCoverHeaderPHB.png
new file mode 100644
index 000000000..f359668ba
Binary files /dev/null and b/themes/assets/partCoverHeaderPHB.png differ
diff --git a/themes/fonts/5e/Martel Sans Black.woff2 b/themes/fonts/5e/Martel Sans Black.woff2
new file mode 100644
index 000000000..44580467d
Binary files /dev/null and b/themes/fonts/5e/Martel Sans Black.woff2 differ
diff --git a/themes/fonts/5e/Nodesto Caps Wide.woff2 b/themes/fonts/5e/Nodesto Caps Wide.woff2
new file mode 100644
index 000000000..d50a19915
Binary files /dev/null and b/themes/fonts/5e/Nodesto Caps Wide.woff2 differ
diff --git a/themes/fonts/5e/fonts.less b/themes/fonts/5e/fonts.less
index a83399567..8f089b51c 100644
--- a/themes/fonts/5e/fonts.less
+++ b/themes/fonts/5e/fonts.less
@@ -107,6 +107,13 @@
font-style: italic;
}
+@font-face {
+ font-family: NodestoCapsWide;
+ src: url('../../../fonts/5e/Nodesto Caps Wide.woff2');
+ font-weight: normal;
+ font-style: normal
+}
+
@font-face {
font-family: Overpass;
src: url('../../../fonts/5e/Overpass Medium.woff2');