mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-22 10:51:30 +00:00
Adding in page ids to allow for hyperlinking
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
# changelog
|
# changelog
|
||||||
|
|
||||||
|
### Friday, 10/06/2016 - v2.2.4
|
||||||
|
- Added an id to each rendered page
|
||||||
|
- Allows adding in hyperlinks to specific pages
|
||||||
|
- Even works after you print to pdf!
|
||||||
|
|
||||||
### Tuesday, 07/06/2016 - v2.2.2
|
### Tuesday, 07/06/2016 - v2.2.2
|
||||||
- Fixed bug with new markdown lexer and aprser not working on print page
|
- Fixed bug with new markdown lexer and aprser not working on print page
|
||||||
|
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ var BrewRenderer = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
},
|
},
|
||||||
|
|
||||||
renderDummyPage : function(key){
|
renderDummyPage : function(index){
|
||||||
return <div className='phb' key={key}>
|
return <div className='phb' id={`p${index + 1}`} key={index}>
|
||||||
<i className='fa fa-spinner fa-spin' />
|
<i className='fa fa-spinner fa-spin' />
|
||||||
</div>
|
</div>
|
||||||
},
|
},
|
||||||
|
|
||||||
renderPage : function(pageText, index){
|
renderPage : function(pageText, index){
|
||||||
return <div className='phb' dangerouslySetInnerHTML={{__html:Markdown.render(pageText)}} key={index} />
|
return <div className='phb' id={`p${index + 1}`} dangerouslySetInnerHTML={{__html:Markdown.render(pageText)}} key={index} />
|
||||||
},
|
},
|
||||||
|
|
||||||
renderPages : function(){
|
renderPages : function(){
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ module.exports = [
|
|||||||
gen : "<div class='pageNumber auto'></div>\n"
|
gen : "<div class='pageNumber auto'></div>\n"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name : "Link to page",
|
||||||
|
icon : 'fa-link',
|
||||||
|
gen : "[Click here](#p3) to go to page 3\n"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ var Navbar = React.createClass({
|
|||||||
<Nav.item href='/' className='homebrewLogo'>
|
<Nav.item href='/' className='homebrewLogo'>
|
||||||
<div>The Homebrewery</div>
|
<div>The Homebrewery</div>
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
<Nav.item>v2.2.3</Nav.item>
|
<Nav.item>v2.2.4</Nav.item>
|
||||||
</Nav.section>
|
</Nav.section>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
</Nav.base>
|
</Nav.base>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "homebrewery",
|
"name": "homebrewery",
|
||||||
"description": "Create authentic looking D&D homebrews using only markdown",
|
"description": "Create authentic looking D&D homebrews using only markdown",
|
||||||
"version": "2.2.3",
|
"version": "2.2.4",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "gulp prod",
|
"postinstall": "gulp prod",
|
||||||
"start": "node server.js"
|
"start": "node server.js"
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ app.get('/print/:id', function(req, res){
|
|||||||
brew = objs[0];
|
brew = objs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
var content = _.map(brew.text.split('\\page'), function(pageText){
|
var content = _.map(brew.text.split('\\page'), function(pageText, index){
|
||||||
return '<div class="phb print">' + Markdown.render(pageText) + '</div>';
|
return `<div class="phb print" id="p${index+1}">` + Markdown.render(pageText) + '</div>';
|
||||||
}).join('\n');
|
}).join('\n');
|
||||||
|
|
||||||
var dialog = '';
|
var dialog = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user