0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Force \page on V3 to be alone on line.

This commit is contained in:
Trevor Buckner
2021-08-31 12:08:31 -04:00
parent e14c8c5e91
commit 1a71ba0eb2
5 changed files with 6 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ const BrewRenderer = createClass({
if(this.props.renderer == 'legacy') {
pages = this.props.text.split('\\page');
} else {
pages = this.props.text.split(/^\\page/gm);
pages = this.props.text.split(/^\\page$/gm);
}
return {
@@ -62,7 +62,7 @@ const BrewRenderer = createClass({
if(this.props.renderer == 'legacy') {
pages = this.props.text.split('\\page');
} else {
pages = this.props.text.split(/^\\page/gm);
pages = this.props.text.split(/^\\page$/gm);
}
this.setState({
pages : pages,

View File

@@ -121,7 +121,7 @@ const Editor = createClass({
// New Codemirror styling for V3 renderer
if(this.props.renderer == 'V3') {
if(line.startsWith('\\page')){
if(line.match(/^\\page$/)){
codeMirror.addLineClass(lineNumber, 'background', 'pageLine');
r.push(lineNumber);
}

View File

@@ -197,7 +197,7 @@ const EditPage = createClass({
const transfer = this.state.saveGoogle == _.isNil(this.state.brew.googleId);
const brew = this.state.brew;
brew.pageCount = ((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page/gm)) || []).length + 1;
brew.pageCount = ((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page$/gm)) || []).length + 1;
if(this.state.saveGoogle) {
if(transfer) {

View File

@@ -161,7 +161,7 @@ const NewPage = createClass({
brew.text = brew.text.slice(index + 5);
};
brew.pageCount=((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page/gm)) || []).length + 1;
brew.pageCount=((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page$/gm)) || []).length + 1;
if(this.state.saveGoogle) {
const res = await request

View File

@@ -45,7 +45,7 @@ const PrintPage = createClass({
key={index} />;
});
} else {
return _.map(this.state.brewText.split(/^\\page/gm), (pageText, index)=>{
return _.map(this.state.brewText.split(/^\\page$/gm), (pageText, index)=>{
pageText += `\n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
return (
<div className='page' id={`p${index + 1}`} key={index} >