mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-11 04:42:42 +00:00
Remove snippet.params
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
module.exports = {
|
||||
createFooter : function(brew, params){
|
||||
const cursorPos = params.cursorPos;
|
||||
const headerSize = params.headerSize || 1;
|
||||
createFooterFunc : function(headerSize=1){
|
||||
return (props)=>{
|
||||
const cursorPos = props.cursorPos;
|
||||
|
||||
let header='';
|
||||
while (header.length < headerSize) {
|
||||
header = header.concat('#');
|
||||
}
|
||||
header = header.concat(' ');
|
||||
let header='';
|
||||
while (header.length < headerSize) {
|
||||
header = header.concat('#');
|
||||
}
|
||||
header = header.concat(' ');
|
||||
|
||||
const textArray = 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) || 'PART 1 | SECTION NAME';
|
||||
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`;
|
||||
return `\n{{footnote ${text}}}\n`;
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user