0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-27 07:23:09 +00:00

change legacy snippets to use named exports and move from dedent-tabs to dedent

This commit is contained in:
Víctor Losada Hernández
2026-01-23 17:38:16 +01:00
parent b72e5b9172
commit dbeff56ffa
27 changed files with 1073 additions and 3262 deletions

View File

@@ -1,12 +1,12 @@
/* eslint-disable max-lines */
import MagicGen from './snippets/magic.gen.js';
import ClassTableGen from './snippets/classtable.gen.js';
import MonsterBlockGen from './snippets/monsterblock.gen.js';
import ClassFeatureGen from './snippets/classfeature.gen.js';
import CoverPageGen from './snippets/coverpage.gen.js';
import TableOfContentsGen from './snippets/tableOfContents.gen.js';
import dedent from 'dedent-tabs';
import MagicGen from './themes/Legacy/5ePHB/snippets/magic.gen.js';
import ClassTableGen from './themes/Legacy/5ePHB/snippets/classtable.gen.js';
import MonsterBlockGen from './themes/Legacy/5ePHB/snippets/monsterblock.gen.js';
import ClassFeatureGen from './themes/Legacy/5ePHB/snippets/classfeature.gen.js';
import CoverPageGen from './themes/Legacy/5ePHB/snippets/coverpage.gen.js';
import TableOfContentsGen from './themes/Legacy/5ePHB/snippets/tableOfContents.gen.js';
import dedent from 'dedent';
export default [

View File

@@ -1,6 +1,6 @@
import _ from 'lodash';
export default function(classname){
function classFeatureGen(classname) {
classname = _.sample(['archivist', 'fancyman', 'linguist', 'fletcher',
'notary', 'berserker-typist', 'fishmongerer', 'manicurist', 'haberdasher', 'concierge']);
@@ -49,4 +49,6 @@ export default function(classname){
`- ${_.sample(['10 lint fluffs', '1 button', 'a cherished lost sock'])}`,
'\n\n\n'
].join('\n');
};
}
export default classFeatureGen;

View File

@@ -98,8 +98,8 @@ const subtitles = [
];
export default ()=>{
return `<style>
function coverPageGen() {
return `<style>
.phb#p1{ text-align:center; }
.phb#p1:after{ display:none; }
</style>
@@ -114,4 +114,6 @@ export default ()=>{
</div>
\\page`;
};
}
export default coverPageGen;

View File

@@ -4,7 +4,7 @@ import ClassFeatureGen from './classfeature.gen.js';
import ClassTableGen from './classtable.gen.js';
export default function(){
function fullClassGen(){
const classname = _.sample(['Archivist', 'Fancyman', 'Linguist', 'Fletcher',
'Notary', 'Berserker-Typist', 'Fishmongerer', 'Manicurist', 'Haberdasher', 'Concierge']);
@@ -40,4 +40,6 @@ export default function(){
].join('\n')}\n\n\n`;
};
}
export default fullClassGen;

View File

@@ -47,7 +47,8 @@ const getTOC = (pages)=>{
return res;
};
export default function(props){
function tableOfContentsGen(props){
const pages = props.brew.text.split('\\page');
const TOC = getTOC(pages);
const markdown = _.reduce(TOC, (r, g1, idx1)=>{
@@ -69,4 +70,6 @@ export default function(props){
##### Table Of Contents
${markdown}
</div>\n`;
};
}
export default tableOfContentsGen;

View File

@@ -6,7 +6,7 @@ import scriptGen from './snippets/script.gen.js';
import ClassFeatureGen from './snippets/classfeature.gen.js';
import CoverPageGen from './snippets/coverpage.gen.js';
import QuoteGen from './snippets/quote.gen.js';
import dedent from 'dedent-tabs';
import dedent from 'dedent';
export default [
{

View File

@@ -1,5 +1,5 @@
import _ from 'lodash';
import dedent from 'dedent-tabs';
import dedent from 'dedent';
export default function(classname){

View File

@@ -1,5 +1,5 @@
import _ from 'lodash';
import dedent from 'dedent-tabs';
import dedent from 'dedent';
const features = [
'Astrological Botany', 'Biochemical Sorcery', 'Civil Divination',

View File

@@ -1,5 +1,5 @@
import _ from 'lodash';
import dedent from 'dedent-tabs';
import dedent from 'dedent';
const titles = [
'The Burning Gallows', 'The Ring of Nenlast',

View File

@@ -1,5 +1,5 @@
import _ from 'lodash';
import dedent from 'dedent-tabs';
import dedent from 'dedent';
const genList = function(list, max){
return _.sampleSize(list, _.random(0, max)).join(', ') || 'None';

View File

@@ -1,5 +1,5 @@
import _ from 'lodash';
import dedent from 'dedent-tabs';
import dedent from 'dedent';
export default {
dwarvish : ()=>{

View File

@@ -1,5 +1,5 @@
/* eslint-disable max-lines */
import dedent from 'dedent-tabs';
import dedent from 'dedent';
import WatercolorGen from './snippets/watercolor.gen.js';
import ImageMaskGen from './snippets/imageMask.gen.js';
import FooterGen from './snippets/footer.gen.js';

View File

@@ -1,5 +1,5 @@
import _ from 'lodash';
import dedent from 'dedent-tabs';
import dedent from 'dedent';
export default {
center : ()=>{

View File

@@ -1,4 +1,4 @@
import dedent from 'dedent-tabs';
import dedent from 'dedent';
export default ()=>{
return dedent`

View File

@@ -1,4 +1,4 @@
import dedent from 'dedent-tabs';
import dedent from 'dedent';
// Map each actual page to its footer label, accounting for skips or numbering resets
const mapPages = (pages)=>{