0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-27 18:13:08 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Trevor Buckner
cb987930f2 Force lists to be "loose" style (wrap text in <p> tags) 2025-03-25 17:34:17 -04:00
16 changed files with 109 additions and 205 deletions

View File

@@ -88,20 +88,6 @@ pre {
## changelog ## changelog
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery). For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
### Tuesday 03/18/2025 - v3.18.1
{{taskList
##### G-Ambatte
* [x] Revert colon rendering from br elements to blank divs
##### 5e-Cleric
* [x] Allow for local connections within a same network when running a local version
Fixes issue [#4094](https://github.com/naturalcrit/homebrewery/issues/4094)
* [x] Add US Letter size page snippet
Fixes issue [#3893](https://github.com/naturalcrit/homebrewery/issues/3893)
}}
### Monday 03/10/2025 - v3.18.0 ### Monday 03/10/2025 - v3.18.0
{{taskList {{taskList
@@ -128,9 +114,6 @@ Fixes issue [#1729](https://github.com/naturalcrit/homebrewery/issues/1729)
##### 5e-Cleric ##### 5e-Cleric
* [x] Style fixes for covers art and logos on A4 size pages * [x] Style fixes for covers art and logos on A4 size pages
* [x] Fix crash when trying to open brews that don't exist * [x] Fix crash when trying to open brews that don't exist
* [x] Tweaks and style update styling on {{openSans **VAULT** :fas_dungeon:}} page.
Fixes issue [#4079](https://github.com/naturalcrit/homebrewery/issues/4079)
##### Calculuschild ##### Calculuschild
* [x] `` now produces `<br>` instead of a `<div>` * [x] `` now produces `<br>` instead of a `<div>`

View File

@@ -39,7 +39,7 @@ const BrewPage = (props)=>{
...props ...props
}; };
const pageRef = useRef(null); const pageRef = useRef(null);
const cleanText = safeHTML(`${props.contents}\n<div class="columnSplit"></div>\n`); const cleanText = safeHTML(props.contents);
useEffect(()=>{ useEffect(()=>{
if(!pageRef.current) return; if(!pageRef.current) return;

View File

@@ -85,9 +85,4 @@
display : inline-block; display : inline-block;
width : 100%; width : 100%;
} }
.blank {
height : 1em;
margin-top: 0;
& + * { margin-top: 0; }
}
} }

View File

@@ -59,13 +59,6 @@
padding-left : 1.25em; padding-left : 1.25em;
list-style : square; list-style : square;
} }
.blank {
height: 1em;
margin-top: 0;
& + * {
margin-top: 0;
}
}
} }
} }
} }

View File

@@ -99,14 +99,14 @@ const VaultPage = (props)=>{
setSearching(true); setSearching(true);
setError(null); setError(null);
const title = titleRef.current.value || ''; const title = titleRef.current.value || '';
const author = authorRef.current.value || ''; const author = authorRef.current.value || '';
const count = countRef.current.value || 10; const count = countRef.current.value || 10;
const v3 = v3Ref.current.checked != false; const v3 = v3Ref.current.checked != false;
const legacy = legacyRef.current.checked != false; const legacy = legacyRef.current.checked != false;
const sortOption = sort || 'title'; const sortOption = sort || 'title';
const dirOption = dir || 'asc'; const dirOption = dir || 'asc';
const pageProp = page || 1; const pageProp = page || 1;
setSort(sortOption); setSort(sortOption);
setdir(dirOption); setdir(dirOption);
@@ -247,7 +247,7 @@ const VaultPage = (props)=>{
</li> </li>
<li> <li>
Some common words like "a", "after", "through", "itself", "here", etc., Some common words like "a", "after", "through", "itself", "here", etc.,
are ignored in searches. The full list can be found&nbsp; are ignored in searches. The full list can be found &nbsp;
<a href='https://github.com/mongodb/mongo/blob/0e3b3ca8480ddddf5d0105d11a94bd4698335312/src/mongo/db/fts/stop_words_english.txt'> <a href='https://github.com/mongodb/mongo/blob/0e3b3ca8480ddddf5d0105d11a94bd4698335312/src/mongo/db/fts/stop_words_english.txt'>
here here
</a> </a>
@@ -286,9 +286,9 @@ const VaultPage = (props)=>{
}; };
const renderPaginationControls = ()=>{ const renderPaginationControls = ()=>{
if(!totalBrews || totalBrews < 10) return null; if(!totalBrews) return null;
const countInt = parseInt(brewCollection.length || 20); const countInt = parseInt(props.query.count || 20);
const totalPages = Math.ceil(totalBrews / countInt); const totalPages = Math.ceil(totalBrews / countInt);
let startPage, endPage; let startPage, endPage;
@@ -355,7 +355,7 @@ const VaultPage = (props)=>{
}; };
const renderFoundBrews = ()=>{ const renderFoundBrews = ()=>{
if(searching && !brewCollection) { if(searching) {
return ( return (
<div className='foundBrews searching'> <div className='foundBrews searching'>
<h3 className='searchAnim'>Searching</h3> <h3 className='searchAnim'>Searching</h3>
@@ -395,7 +395,6 @@ const VaultPage = (props)=>{
{`Brews found: `} {`Brews found: `}
<span>{totalBrews}</span> <span>{totalBrews}</span>
</span> </span>
{brewCollection.length > 10 && renderPaginationControls()}
{brewCollection.map((brew, index)=>{ {brewCollection.map((brew, index)=>{
return ( return (
<BrewItem <BrewItem
@@ -416,14 +415,14 @@ const VaultPage = (props)=>{
<link href='/themes/V3/Blank/style.css' rel='stylesheet' /> <link href='/themes/V3/Blank/style.css' rel='stylesheet' />
<link href='/themes/V3/5ePHB/style.css' rel='stylesheet' /> <link href='/themes/V3/5ePHB/style.css' rel='stylesheet' />
{renderNavItems()} {renderNavItems()}
<div className='content'> <div className="content">
<SplitPane showDividerButtons={false}> <SplitPane showDividerButtons={false}>
<div className='form dataGroup'>{renderForm()}</div> <div className='form dataGroup'>{renderForm()}</div>
<div className='resultsContainer dataGroup'> <div className='resultsContainer dataGroup'>
{renderSortBar()} {renderSortBar()}
{renderFoundBrews()} {renderFoundBrews()}
</div> </div>
</SplitPane> </SplitPane>
</div> </div>
</div> </div>
); );

View File

@@ -5,7 +5,7 @@
*:not(input) { user-select : none; } *:not(input) { user-select : none; }
:where(.content .dataGroup) { .content .dataGroup {
width : 100%; width : 100%;
height : 100%; height : 100%;
background : white; background : white;
@@ -169,10 +169,9 @@
width : 100%; width : 100%;
height : 100%; height : 100%;
max-height : 100%; max-height : 100%;
padding : 70px 50px; padding : 50px 50px 70px 50px;
overflow-y : scroll; overflow-y : scroll;
background-color : #2C3E50; background-color : #2C3E50;
container-type : inline-size;
h3 { font-size : 25px; } h3 { font-size : 25px; }
@@ -237,7 +236,6 @@
margin-right : 40px; margin-right : 40px;
color : black; color : black;
isolation : isolate; isolation : isolate;
transition : width 0.5s;
&::after { &::after {
position : absolute; position : absolute;
@@ -271,8 +269,8 @@
.links { z-index : 2; } .links { z-index : 2; }
hr { hr {
visibility : hidden;
margin : 0px; margin : 0px;
visibility : hidden;
} }
.thumbnail { z-index : -1; } .thumbnail { z-index : -1; }
@@ -280,37 +278,30 @@
.paginationControls { .paginationControls {
position : absolute; position : absolute;
top : 35px;
left : 50%; left : 50%;
display : grid; display : grid;
grid-template-areas : 'previousPage currentPage nextPage'; grid-template-areas : 'previousPage currentPage nextPage';
grid-template-columns : 50px 1fr 50px; grid-template-columns : 50px 1fr 50px;
gap : 20px;
place-items : center; place-items : center;
width : auto; width : auto;
font-size : 15px;
translate : -50%; translate : -50%;
&:last-child { top : unset; }
.pages { .pages {
display : flex; display : flex;
grid-area : currentPage; grid-area : currentPage;
gap : 1em;
justify-content : space-evenly; justify-content : space-evenly;
width : 100%; width : 100%;
height : 100%; height : 100%;
padding : 5px 8px;
text-align : center; text-align : center;
.pageNumber { .pageNumber {
place-content : center; margin-inline : 1vw;
width : fit-content;
min-width : 2em;
font-family : 'Open Sans'; font-family : 'Open Sans';
font-weight : 900; font-weight : 900;
color : white; color : white;
text-wrap : nowrap;
text-underline-position : under; text-underline-position : under;
text-wrap : nowrap;
cursor : pointer; cursor : pointer;
&.currentPage { &.currentPage {
@@ -338,6 +329,7 @@
} }
} }
} }
} }
@keyframes trailingDots { @keyframes trailingDots {
@@ -352,7 +344,8 @@
100% { content : ' ...'; } 100% { content : ' ...'; }
} }
@container (width < 670px) { // media query for when the page is smaller than 1079 px in width
@media screen and (max-width : 1079px) {
.vaultPage { .vaultPage {
.dataGroup.form .brewLookup { padding : 1px 20px 20px 10px; } .dataGroup.form .brewLookup { padding : 1px 20px 20px 10px; }

136
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "homebrewery", "name": "homebrewery",
"version": "3.18.1", "version": "3.18.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "homebrewery", "name": "homebrewery",
"version": "3.18.1", "version": "3.18.0",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -23,6 +23,7 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"create-react-class": "^15.7.0", "create-react-class": "^15.7.0",
"dedent-tabs": "^0.10.3", "dedent-tabs": "^0.10.3",
"dompurify": "^3.2.4",
"expr-eval": "^2.0.2", "expr-eval": "^2.0.2",
"express": "^4.21.2", "express": "^4.21.2",
"express-async-handler": "^1.2.0", "express-async-handler": "^1.2.0",
@@ -35,14 +36,14 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"marked": "14.0.0", "marked": "14.0.0",
"marked-emoji": "^2.0.0", "marked-emoji": "^2.0.0",
"marked-extended-tables": "^2.0.1", "marked-extended-tables": "^2.0.0",
"marked-gfm-heading-id": "^4.0.1", "marked-gfm-heading-id": "^4.0.1",
"marked-smartypants-lite": "^1.0.3", "marked-smartypants-lite": "^1.0.3",
"marked-subsuper-text": "^1.0.3", "marked-subsuper-text": "^1.0.3",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1", "moment": "^2.30.1",
"mongoose": "^8.12.1", "mongoose": "^8.12.1",
"nanoid": "5.1.3", "nanoid": "5.1.2",
"nconf": "^0.12.1", "nconf": "^0.12.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
@@ -376,13 +377,13 @@
} }
}, },
"node_modules/@babel/helpers": { "node_modules/@babel/helpers": {
"version": "7.26.10", "version": "7.26.9",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz",
"integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/template": "^7.26.9", "@babel/template": "^7.26.9",
"@babel/types": "^7.26.10" "@babel/types": "^7.26.9"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@@ -1688,10 +1689,9 @@
} }
}, },
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {
"version": "7.26.10", "version": "7.25.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.9.tgz",
"integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==", "integrity": "sha512-4zpTHZ9Cm6L9L+uIqghQX8ZXg8HKFcjYO3qHoO8zTmRm6HQUJ8SSJ+KRvbMBZn0EGVlT4DRYeQ/6hjlyXBh+Kg==",
"license": "MIT",
"dependencies": { "dependencies": {
"regenerator-runtime": "^0.14.0" "regenerator-runtime": "^0.14.0"
}, },
@@ -1741,9 +1741,9 @@
} }
}, },
"node_modules/@babel/types": { "node_modules/@babel/types": {
"version": "7.26.10", "version": "7.26.9",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz",
"integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/helper-string-parser": "^7.25.9", "@babel/helper-string-parser": "^7.25.9",
@@ -2953,6 +2953,12 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/trusted-types": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
"optional": true
},
"node_modules/@types/webidl-conversions": { "node_modules/@types/webidl-conversions": {
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
@@ -3878,16 +3884,6 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"license": "MIT",
"optional": true,
"dependencies": {
"file-uri-to-path": "1.0.0"
}
},
"node_modules/bn.js": { "node_modules/bn.js": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz",
@@ -4410,20 +4406,6 @@
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },
"node_modules/chokidar/node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/chokidar/node_modules/glob-parent": { "node_modules/chokidar/node_modules/glob-parent": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
@@ -5384,6 +5366,15 @@
"npm": ">=1.2" "npm": ">=1.2"
} }
}, },
"node_modules/dompurify": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.4.tgz",
"integrity": "sha512-ysFSFEDVduQpyhzAob/kkuJjf5zWkZD8/A9ywSp1byueyuCfHamrCBa14/Oc2iiB0e51B+NpxSl5gmzn+Ms/mg==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
}
},
"node_modules/dunder-proto": { "node_modules/dunder-proto": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
@@ -5428,10 +5419,9 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/elliptic": { "node_modules/elliptic": {
"version": "6.6.1", "version": "6.6.0",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.0.tgz",
"integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", "integrity": "sha512-dpwoQcLc/2WLQvJvLRHKZ+f9FgOdjnq11rurqwekGQygGPsYSK29OMMD2WalatiqQ+XGFDglTNixpPfI+lpaAA==",
"license": "MIT",
"dependencies": { "dependencies": {
"bn.js": "^4.11.9", "bn.js": "^4.11.9",
"brorand": "^1.1.0", "brorand": "^1.1.0",
@@ -6398,13 +6388,6 @@
"node": ">=16.0.0" "node": ">=16.0.0"
} }
}, },
"node_modules/file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"license": "MIT",
"optional": true
},
"node_modules/fill-range": { "node_modules/fill-range": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
@@ -6579,25 +6562,6 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/fsevents": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"deprecated": "Upgrade to fsevents v2 to mitigate potential security issues",
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"dependencies": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
},
"engines": {
"node": ">= 4.0"
}
},
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@@ -8595,21 +8559,6 @@
"fsevents": "^2.3.2" "fsevents": "^2.3.2"
} }
}, },
"node_modules/jest-haste-map/node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/jest-leak-detector": { "node_modules/jest-leak-detector": {
"version": "29.7.0", "version": "29.7.0",
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz",
@@ -9925,9 +9874,9 @@
} }
}, },
"node_modules/marked-extended-tables": { "node_modules/marked-extended-tables": {
"version": "2.0.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/marked-extended-tables/-/marked-extended-tables-2.0.1.tgz", "resolved": "https://registry.npmjs.org/marked-extended-tables/-/marked-extended-tables-2.0.0.tgz",
"integrity": "sha512-DV4Si978ZdaFbycIxzG4TdaNMtC0J8QfIKj1UOCejgJHwVjVJse8DNdJriWDeo/n74DWVYpRC6S56AdgWDPrPA==", "integrity": "sha512-MWmxvFLkJYQ5K46MFieOP1uueMgfIpDPMkYLLgIyTl20HyvLIW4J37BAtIGfR8fDp2uE4Kyyev4s3dhoT2FQOA==",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"marked": ">=3 <16" "marked": ">=3 <16"
@@ -10472,17 +10421,10 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
}, },
"node_modules/nan": {
"version": "2.22.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.22.2.tgz",
"integrity": "sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==",
"license": "MIT",
"optional": true
},
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "5.1.3", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.3.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.2.tgz",
"integrity": "sha512-zAbEOEr7u2CbxwoMRlz/pNSpRP0FdAU4pRaYunCdEezWohXFs+a0Xw7RfkKaezMsmSM1vttcLthJtwRnVtOfHQ==", "integrity": "sha512-b+CiXQCNMUGe0Ri64S9SXFcP9hogjAJ2Rd6GdVxhPLRm7mhGaM7VgOvCAJ1ZshfHbqVDI3uqTI5C8/GaKuLI7g==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",

View File

@@ -1,7 +1,7 @@
{ {
"name": "homebrewery", "name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown", "description": "Create authentic looking D&D homebrews using only markdown",
"version": "3.18.1", "version": "3.18.0",
"type": "module", "type": "module",
"engines": { "engines": {
"npm": "^10.2.x", "npm": "^10.2.x",
@@ -97,6 +97,7 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"create-react-class": "^15.7.0", "create-react-class": "^15.7.0",
"dedent-tabs": "^0.10.3", "dedent-tabs": "^0.10.3",
"dompurify": "^3.2.4",
"expr-eval": "^2.0.2", "expr-eval": "^2.0.2",
"express": "^4.21.2", "express": "^4.21.2",
"express-async-handler": "^1.2.0", "express-async-handler": "^1.2.0",
@@ -109,14 +110,14 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"marked": "14.0.0", "marked": "14.0.0",
"marked-emoji": "^2.0.0", "marked-emoji": "^2.0.0",
"marked-extended-tables": "^2.0.1", "marked-extended-tables": "^2.0.0",
"marked-gfm-heading-id": "^4.0.1", "marked-gfm-heading-id": "^4.0.1",
"marked-smartypants-lite": "^1.0.3", "marked-smartypants-lite": "^1.0.3",
"marked-subsuper-text": "^1.0.3", "marked-subsuper-text": "^1.0.3",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1", "moment": "^2.30.1",
"mongoose": "^8.12.1", "mongoose": "^8.12.1",
"nanoid": "5.1.3", "nanoid": "5.1.2",
"nconf": "^0.12.1", "nconf": "^0.12.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",

View File

@@ -71,8 +71,7 @@ const corsOptions = {
]; ];
if(isLocalEnvironment) { if(isLocalEnvironment) {
const localNetworkRegex = /^http:\/\/(localhost|127\.0\.0\.1|10\.\d+\.\d+\.\d+|192\.168\.\d+\.\d+|172\.(1[6-9]|2\d|3[0-1])\.\d+\.\d+):\d+$/; allowedOrigins.push('http://localhost:8000', 'http://localhost:8010');
allowedOrigins.push(localNetworkRegex);
} }
const herokuRegex = /^https:\/\/(?:homebrewery-pr-\d+\.herokuapp\.com|naturalcrit-pr-\d+\.herokuapp\.com)$/; // Matches any Heroku app const herokuRegex = /^https:\/\/(?:homebrewery-pr-\d+\.herokuapp\.com|naturalcrit-pr-\d+\.herokuapp\.com)$/; // Matches any Heroku app

View File

@@ -1,6 +1,6 @@
import express from 'express'; import express from 'express';
import asyncHandler from 'express-async-handler'; import asyncHandler from 'express-async-handler';
import { model as HomebrewModel } from './homebrew.model.js'; import {model as HomebrewModel } from './homebrew.model.js';
const router = express.Router(); const router = express.Router();
@@ -29,7 +29,7 @@ const rendererConditions = (legacy, v3)=>{
return {}; // If all renderers selected, renderer field not needed in query for speed return {}; // If all renderers selected, renderer field not needed in query for speed
}; };
const sortConditions = (sort, dir)=>{ const sortConditions = (sort, dir) => {
return { [sort]: dir === 'asc' ? 1 : -1 }; return { [sort]: dir === 'asc' ? 1 : -1 };
}; };

View File

@@ -381,7 +381,12 @@ const forcedParagraphBreaks = {
tokenizer(src, tokens) { tokenizer(src, tokens) {
const regex = /^(:+)(?:\n|$)/ym; const regex = /^(:+)(?:\n|$)/ym;
const match = regex.exec(src); const match = regex.exec(src);
if(match?.length) { if(match?.length) {
const lastToken = tokens[tokens.length - 1];
if(lastToken?.type == 'text')
lastToken.type = 'paragraph';
return { return {
type : 'hardBreaks', // Should match "name" above type : 'hardBreaks', // Should match "name" above
raw : match[0], // Text to consume from the source raw : match[0], // Text to consume from the source
@@ -391,10 +396,18 @@ const forcedParagraphBreaks = {
} }
}, },
renderer(token) { renderer(token) {
return `<div class='blank'></div>\n`.repeat(token.length); return `<br>\n`.repeat(token.length);
} }
}; };
const patchHardBreaks = {
walkTokens(token) {
if(token.type == 'list' || token.type == 'list_item') {
token.loose = true;
}
}
}
const nonbreakingSpaces = { const nonbreakingSpaces = {
name : 'nonbreakingSpaces', name : 'nonbreakingSpaces',
level : 'inline', level : 'inline',
@@ -774,6 +787,7 @@ Marked.use(MarkedVariables());
Marked.use({ extensions : [justifiedParagraphs, definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks, Marked.use({ extensions : [justifiedParagraphs, definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks,
nonbreakingSpaces, mustacheSpans, mustacheDivs, mustacheInjectInline] }); nonbreakingSpaces, mustacheSpans, mustacheDivs, mustacheInjectInline] });
Marked.use(mustacheInjectBlock); Marked.use(mustacheInjectBlock);
Marked.use(patchHardBreaks);
Marked.use(MarkedSubSuperText()); Marked.use(MarkedSubSuperText());
Marked.use({ renderer: renderer, tokenizer: tokenizer, mangle: false }); Marked.use({ renderer: renderer, tokenizer: tokenizer, mangle: false });
Marked.use(MarkedExtendedTables({interruptPatterns : tableTerminators}), MarkedGFMHeadingId({ globalSlugs: true }), Marked.use(MarkedExtendedTables({interruptPatterns : tableTerminators}), MarkedGFMHeadingId({ globalSlugs: true }),

View File

@@ -1,4 +1,4 @@
/* eslint-disable max-lines */
import Markdown from 'naturalcrit/markdown.js'; import Markdown from 'naturalcrit/markdown.js';
@@ -92,12 +92,12 @@ describe('Multiline Definition Lists', ()=>{
test('Multiline Definition Term must have at least one non-empty Definition', function() { test('Multiline Definition Term must have at least one non-empty Definition', function() {
const source = 'Term 1\n::'; const source = 'Term 1\n::';
const rendered = Markdown.render(source).trim(); const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Term 1</p>\n<div class='blank'></div>\n<div class='blank'></div>`); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Term 1</p>\n<br>\n<br>`);
}); });
test('Multiline Definition List must have at least one non-newline character after ::', function() { test('Multiline Definition List must have at least one non-newline character after ::', function() {
const source = 'Term 1\n::\nDefinition 1\n\n'; const source = 'Term 1\n::\nDefinition 1\n\n';
const rendered = Markdown.render(source).trim(); const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Term 1</p>\n<div class='blank'></div>\n<div class='blank'></div>\n<p>Definition 1</p>`); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Term 1</p>\n<br>\n<br>\n<p>Definition 1</p>`);
}); });
}); });

View File

@@ -1,4 +1,4 @@
/* eslint-disable max-lines */
import Markdown from 'naturalcrit/markdown.js'; import Markdown from 'naturalcrit/markdown.js';
@@ -6,37 +6,37 @@ describe('Hard Breaks', ()=>{
test('Single Break', function() { test('Single Break', function() {
const source = ':\n\n'; const source = ':\n\n';
const rendered = Markdown.render(source).trim(); const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div>`); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<br>`);
}); });
test('Double Break', function() { test('Double Break', function() {
const source = '::\n\n'; const source = '::\n\n';
const rendered = Markdown.render(source).trim(); const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div>\n<div class='blank'></div>`); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<br>\n<br>`);
}); });
test('Triple Break', function() { test('Triple Break', function() {
const source = ':::\n\n'; const source = ':::\n\n';
const rendered = Markdown.render(source).trim(); const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>`); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<br>\n<br>\n<br>`);
}); });
test('Many Break', function() { test('Many Break', function() {
const source = '::::::::::\n\n'; const source = '::::::::::\n\n';
const rendered = Markdown.render(source).trim(); const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>`); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>`);
}); });
test('Multiple sets of Breaks', function() { test('Multiple sets of Breaks', function() {
const source = ':::\n:::\n:::'; const source = ':::\n:::\n:::';
const rendered = Markdown.render(source).trim(); const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>\n<div class='blank'></div>`); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>`);
}); });
test('Break directly between two paragraphs', function() { test('Break directly between two paragraphs', function() {
const source = 'Line 1\n::\nLine 2'; const source = 'Line 1\n::\nLine 2';
const rendered = Markdown.render(source).trim(); const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Line 1</p>\n<div class='blank'></div>\n<div class='blank'></div>\n<p>Line 2</p>`); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Line 1</p>\n<br>\n<br>\n<p>Line 2</p>`);
}); });
test('Ignored inside a code block', function() { test('Ignored inside a code block', function() {

View File

@@ -57,12 +57,13 @@
ul { ul {
padding-left : 1.4em; padding-left : 1.4em;
margin-bottom : 0.8em; margin-bottom : 0.8em;
line-height : 1.25em;
} }
ol { ol {
padding-left : 1.4em; padding-left : 1.4em;
margin-bottom : 0.8em; margin-bottom : 0.8em;
line-height : 1.25em; }
.page li p {
line-height : 1.25em;
} }
//Indents after p or lists //Indents after p or lists
p + p, ul + p, ol + p { text-indent : 1em; } p + p, ul + p, ol + p { text-indent : 1em; }
@@ -137,6 +138,9 @@
line-height : 0.951em; //Font is misaligned. Shift up slightly line-height : 0.951em; //Font is misaligned. Shift up slightly
& + * { margin-top : 0.2cm; } & + * { margin-top : 0.2cm; }
} }
br + h3, br + h4 {
margin-top : 0;
}
// ***************************** // *****************************
// * TABLE // * TABLE
// *****************************/ // *****************************/
@@ -545,9 +549,8 @@
columns : 1; columns : 1;
text-align : center; text-align : center;
&::after { display : none; } &::after { display : none; }
.frontCover { position : absolute; }
h1 { h1 {
margin-top : 1.55cm; margin-top : 1.2cm;
margin-bottom : 0; margin-bottom : 0;
font-family : 'NodestoCapsCondensed'; font-family : 'NodestoCapsCondensed';
font-size : 2.245cm; font-size : 2.245cm;
@@ -633,9 +636,8 @@
columns : 1; columns : 1;
text-align : center; text-align : center;
&::after { display : none; } &::after { display : none; }
.insideCover { position : absolute; }
h1 { h1 {
margin-top : 1.55cm; margin-top : 1.2cm;
margin-bottom : 0; margin-bottom : 0;
font-family : 'NodestoCapsCondensed'; font-family : 'NodestoCapsCondensed';
font-size : 2.1cm; font-size : 2.1cm;
@@ -689,7 +691,6 @@
background-repeat : no-repeat; background-repeat : no-repeat;
background-size : contain; background-size : contain;
} }
.blank { height: 1.4em; }
h1 { h1 {
margin-bottom : 0.3cm; margin-bottom : 0.3cm;
font-family : 'NodestoCapsCondensed'; font-family : 'NodestoCapsCondensed';

View File

@@ -438,15 +438,6 @@ module.exports = [
icon : 'fas fa-print', icon : 'fas fa-print',
view : 'style', view : 'style',
snippets : [ snippets : [
{
name : 'US Letter Page Size',
icon : 'far fa-file',
gen : dedent`/* US Letter Page Size */
.page {
width : 215.9mm; /* 8.5in */
height : 279.4mm; /* 11in */
}\n\n`,
},
{ {
name : 'A3 Page Size', name : 'A3 Page Size',
icon : 'far fa-file', icon : 'far fa-file',

View File

@@ -437,13 +437,6 @@ body { counter-reset : page-numbers 0; }
margin-bottom : 1em; margin-bottom : 1em;
& + * { margin-top : 0; } & + * { margin-top : 0; }
} }
.blank {
height: 1em;
margin-top: 0;
& + * {
margin-top: 0;
}
}
} }
//***************************** //*****************************