-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from withanage/master
Added NLM JATS disp-quote support
- Loading branch information
Showing
7 changed files
with
155 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
/node_modules/ | ||
*.sublime-* | ||
dist/* | ||
dist/* | ||
.idea/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"use strict"; | ||
|
||
module.exports = { | ||
Model: require('./quote'), | ||
View: require('./quote_view') | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
.content-node.quote > .content { | ||
padding: 20px; | ||
} | ||
|
||
.document .content-node.quote .content-node.paragraph { | ||
padding: 10px 40px 10px 40px; | ||
border-left: 3px solid #ccc; | ||
} | ||
|
||
.surface.content .content-node.quote { | ||
|
||
} | ||
|
||
.surface.content .content-node.quote > .content { | ||
|
||
} | ||
|
||
|
||
.surface.content .content-node.quote > .content > .label { | ||
font-weight: 600; | ||
padding-bottom: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"use strict"; | ||
|
||
var Document = require('../../../substance/document'); | ||
var Composite = Document.Composite; | ||
|
||
// Lens.Quote | ||
// ----------------- | ||
// | ||
|
||
var Quote = function(node, doc) { | ||
Composite.call(this, node, doc); | ||
}; | ||
|
||
// Type definition | ||
// ----------------- | ||
// | ||
|
||
Quote.type = { | ||
"id": "quote", | ||
"parent": "content", | ||
"properties": { | ||
"source_id": "string", | ||
"label": "string", | ||
"children": ["array", "paragraph"] | ||
} | ||
}; | ||
|
||
// This is used for the auto-generated docs | ||
// ----------------- | ||
// | ||
|
||
Quote.description = { | ||
"name": "Quote", | ||
"remarks": ["A quote type."], | ||
"properties": { | ||
"label": "string", | ||
"children": "0..n Paragraph nodes" | ||
} | ||
}; | ||
|
||
|
||
// Example Quote | ||
// ----------------- | ||
// | ||
|
||
Quote.example = { | ||
"id": "quote_1", | ||
"type": "quote", | ||
"label": "Quote 1", | ||
"children": ["paragraph_1", "paragraph_2"] | ||
}; | ||
|
||
Quote.Prototype = function() { | ||
|
||
this.getChildrenIds = function() { | ||
return this.properties.children; | ||
}; | ||
|
||
}; | ||
|
||
Quote.Prototype.prototype = Composite.prototype; | ||
Quote.prototype = new Quote.Prototype(); | ||
Quote.prototype.constructor = Quote; | ||
|
||
Document.Node.defineProperties(Quote); | ||
|
||
module.exports = Quote; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use strict"; | ||
|
||
var NodeView = require('../node').View; | ||
var CompositeView = require("../composite").View; | ||
var $$ = require("../../../substance/application").$$; | ||
|
||
// Lens.Quote.View | ||
// ========================================================================== | ||
|
||
var QuoteView = function(node, viewFactory) { | ||
CompositeView.call(this, node, viewFactory); | ||
}; | ||
|
||
QuoteView.Prototype = function() { | ||
|
||
this.render = function() { | ||
NodeView.prototype.render.call(this); | ||
|
||
if (this.node.label) { | ||
var labelEl = $$('.label', { | ||
text: this.node.label | ||
}); | ||
this.content.appendChild(labelEl); | ||
} | ||
|
||
this.renderChildren(); | ||
this.el.appendChild(this.content); | ||
return this; | ||
}; | ||
}; | ||
|
||
QuoteView.Prototype.prototype = CompositeView.prototype; | ||
QuoteView.prototype = new QuoteView.Prototype(); | ||
|
||
module.exports = QuoteView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters