0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-11 06:52:38 +00:00

Relocate from 5ePHB to Blank theme

This commit is contained in:
G.Ambatte
2023-06-15 13:42:10 +12:00
parent ade61971d0
commit e06f5e17d9
3 changed files with 46 additions and 51 deletions

View File

@@ -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 = [
@@ -22,9 +23,51 @@ module.exports = [
gen : '\n\\page\n'
},
{
name : 'Page Break with Footer',
icon : 'fas fa-file',
gen : '\n{{footnote PART 1 | SECTION NAME}}\n{{pageNumber,auto}}\n\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',

View File

@@ -0,0 +1,19 @@
module.exports = {
createFooterFunc : function(headerSize=1){
return (props)=>{
const cursorPos = props.cursorPos;
let header='';
while (header.length < headerSize) {
header = header.concat('#');
}
header = header.concat(' ');
const textArray = props.brew.text.split('\n').slice(0, cursorPos.line).reverse();
const textArrayFilter = textArray.filter((line)=>{ return line.slice(0, header.length) == header; });
const text = textArrayFilter[0]?.slice(header.length).trim() || 'PART 1 | SECTION NAME';
return `\n{{footnote ${text}}}\n`;
};
}
};