mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-21 15:31:30 +00:00
Column split now a key word
This commit is contained in:
8
scripts/notes.js
Normal file
8
scripts/notes.js
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
require('fixme')({
|
||||
path: process.cwd(),
|
||||
ignored_directories: ['node_modules/**', '.git/**', 'build/**'],
|
||||
file_patterns: ['**/*.js', '**/*.jsx', '**/*.less'],
|
||||
file_encoding: 'utf8',
|
||||
line_length_limit: 200
|
||||
});
|
||||
@@ -105,6 +105,11 @@ const BrewEditor = React.createClass({
|
||||
r.push(lineNumber);
|
||||
}
|
||||
|
||||
if(line.indexOf('\\column') !== -1){
|
||||
codeMirror.addLineClass(lineNumber, 'text', 'columnSplit');
|
||||
r.push(lineNumber);
|
||||
}
|
||||
|
||||
if(_.startsWith(line, '{{') || _.startsWith(line, '}}')){
|
||||
codeMirror.addLineClass(lineNumber, 'text', 'block');
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
color : purple;
|
||||
//font-style: italic;
|
||||
}
|
||||
.columnSplit{
|
||||
font-style : italic;
|
||||
color : grey;
|
||||
}
|
||||
}
|
||||
|
||||
.brewJump{
|
||||
|
||||
@@ -133,6 +133,11 @@ const BrewRenderer = React.createClass({
|
||||
return this.lastRender;
|
||||
},
|
||||
|
||||
//TODO: This is pretty bad
|
||||
renderStyle : function(){
|
||||
return <style>{this.props.brew.style.replace(/;/g, ' !important;')}</style>
|
||||
},
|
||||
|
||||
render : function(){
|
||||
if(this.props.brew.version == 1) return <OldBrewRenderer value={this.props.brew.text} />;
|
||||
|
||||
@@ -146,7 +151,7 @@ const BrewRenderer = React.createClass({
|
||||
<RenderWarnings />
|
||||
|
||||
|
||||
<style>{this.props.brew.style}</style>
|
||||
{this.renderStyle()}
|
||||
|
||||
<div className='pages' ref='pages'>
|
||||
{this.renderPages()}
|
||||
|
||||
@@ -31,6 +31,9 @@ module.exports = {
|
||||
marked : Markdown,
|
||||
render : (rawBrewText)=>{
|
||||
blockCount = 0;
|
||||
|
||||
rawBrewText = rawBrewText.replace(/\\column/g, '{{columnSplit }}')
|
||||
|
||||
let html = Markdown(rawBrewText, {renderer : renderer, sanitize: true});
|
||||
//Close all hanging block tags
|
||||
html += _.times(blockCount, ()=>{return '</div>'}).join('\n');
|
||||
|
||||
@@ -57,11 +57,22 @@
|
||||
-moz-column-span : all;
|
||||
}
|
||||
|
||||
.twoCol{
|
||||
background-color: red;
|
||||
.oneColumn{
|
||||
column-count : 1;
|
||||
}
|
||||
.twoColumn{
|
||||
column-count : 2;
|
||||
}
|
||||
.threeColumn{
|
||||
column-count : 3;
|
||||
}
|
||||
.fourColumn{
|
||||
column-count : 4;
|
||||
}
|
||||
|
||||
.columnSplit{
|
||||
//TODO: make \column trigger this
|
||||
visibility : hidden;
|
||||
-webkit-column-break-after : always;
|
||||
break-after : always;
|
||||
-moz-column-break-after : always;
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
@import './phb.blocks.less';
|
||||
|
||||
|
||||
@page { margin: 0; } //????
|
||||
@page { margin: 0; } //TODO: ????
|
||||
|
||||
|
||||
.useColumns(@multiplier : 1){
|
||||
@@ -322,12 +322,14 @@
|
||||
list-style-type : none;
|
||||
}
|
||||
//Column Break
|
||||
/*
|
||||
pre, code{
|
||||
visibility : hidden;
|
||||
-webkit-column-break-after : always;
|
||||
break-after : always;
|
||||
-moz-column-break-after : always;
|
||||
}
|
||||
*/
|
||||
//Avoid breaking up
|
||||
p,blockquote,table{
|
||||
z-index : 15;
|
||||
|
||||
12
shared/homebrewery/snippets/style/bg.snippet.js
Normal file
12
shared/homebrewery/snippets/style/bg.snippet.js
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
dmg : ()=>{
|
||||
return `.phb{
|
||||
background-image: url('/assets/homebrewery/phb_style/img/dmg_bg.jpg');
|
||||
}`;
|
||||
},
|
||||
dark: ()=>{
|
||||
return `.phb{
|
||||
background-image: url('/assets/homebrewery/phb_style/img/phb_dark_bg.jpg');
|
||||
}`;
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,6 @@ const _ = require('lodash');
|
||||
|
||||
module.exports = _.merge(
|
||||
require('./ink.snippet.js'),
|
||||
require('./a4.snippet.js')
|
||||
require('./a4.snippet.js'),
|
||||
require('./bg.snippet.js')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user