mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-28 07:02:38 +00:00
Changed tactic per suggestion
Unsure if the test is absolutely necessary.
This commit is contained in:
@@ -196,8 +196,8 @@ const BrewRenderer = (props)=>{
|
||||
pageText = pageText.includes('\n') ? pageText.substring(pageText.indexOf('\n') + 1) : ''; // Remove the \page line
|
||||
}
|
||||
|
||||
pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
|
||||
const html = Markdown.render(pageText, index);
|
||||
let html = Markdown.render(pageText, index);
|
||||
if(html.indexOf(`\n<div class='columnSplit'></div>\n`) == -1) html += `\n<div class='columnSplit'></div>\n`;
|
||||
|
||||
return <BrewPage className={classes} index={index} key={index} contents={html} style={styles} attributes={attributes} onVisibilityChange={handlePageVisibilityChange} />;
|
||||
}
|
||||
|
||||
@@ -895,18 +895,6 @@ const globalVarsList = {};
|
||||
let varsQueue = [];
|
||||
let globalPageNumber = 0;
|
||||
|
||||
const closePre = (text)=>{
|
||||
const cols = text.split(/^\\column$/gm);
|
||||
if((cols[0].match(/```/g)||[]).length % 2 != 0) {
|
||||
// Catch inserted column pattern
|
||||
if(cols[0].endsWith('\n\n \n')) {
|
||||
cols[0] = cols[0].slice(0, cols[0].length-'\n\n \n'.length);
|
||||
cols[0] += '\n```\n\n \n';
|
||||
} else cols[0] += '\n```\n';
|
||||
}
|
||||
return cols.join(`\n\\column\n`);
|
||||
};
|
||||
|
||||
const Markdown = {
|
||||
marked : Marked,
|
||||
render : (rawBrewText, pageNumber=0)=>{
|
||||
@@ -917,7 +905,7 @@ const Markdown = {
|
||||
MarkedGFMResetHeadingIDs();
|
||||
}
|
||||
|
||||
rawBrewText = closePre(rawBrewText).replace(/^\\column$/gm, `\n<div class='columnSplit'></div>\n`);
|
||||
rawBrewText = rawBrewText.replace(/^\\column$/gm, `\n<div class='columnSplit'></div>\n`);
|
||||
|
||||
const opts = Marked.defaults;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user