Skip to content

Commit

Permalink
Quick enhanceTables function for eLife to replace bold, italic, and t…
Browse files Browse the repository at this point in the history
…able styles. Also add additional CSS author callout styles.
  • Loading branch information
gnott committed Jul 8, 2017
1 parent 50c47c7 commit 1bc10a0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
14 changes: 14 additions & 0 deletions converter/elife_converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,20 @@ ElifeConverter.Prototype = function() {
}
};

this.enhanceTable = function(state, tableNode, tableWrap) {
tableNode.content = this.enhanceHTML(tableNode.content);
}

this.enhanceHTML = function(html) {
html = html.replace(/<(\/)?bold>/g, "<$1strong>");
html = html.replace(/<(\/)?italic>/g, "<$1em>");
// Table colours
html = html.replace(/<td style=\"([^"]+)\"([^>]*)>/g, "<td class=\"$1\"$2>");
// named-content span
html = html.replace(/<named-content content-type="([^"]+)"([^>]*)>([^<]*)<\/named-content>/g, "<span class=\"$1\"$2>$3</span>");
return html;
};

this.enhanceVideo = function(state, node, element) {
var href = element.getAttribute("xlink:href").split(".");
var name = href[0];
Expand Down
44 changes: 44 additions & 0 deletions styles/lens.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,50 @@ p:last-child { padding-bottom: 0; }
color: gold;
}

.author-callout-style-a1 {
color: rgb(54, 107, 251); // Blue
}

.author-callout-style-a2 {
color: rgb(156, 39, 176); // Purple
}

.author-callout-style-a3 {
color: rgb(213, 0, 0); // Red
}

.author-callout-style-b1 {
background-color: rgb(144, 202, 249); // Blue
}

.author-callout-style-b2 {
background-color: rgb(197, 225, 165); // Green
}

.author-callout-style-b3 {
background-color: rgb(255, 183, 77); // Orange
}

.author-callout-style-b4 {
background-color: rgb(255, 241, 118); // Yellow
}

.author-callout-style-b5 {
background-color: rgb(158, 134, 201); // Purple
}

.author-callout-style-b6 {
background-color: rgb(229, 115, 115); // Red
}

.author-callout-style-b7 {
background-color: rgb(244, 143, 177); // Pink
}

.author-callout-style-b8 {
background-color: rgb(230, 230, 230); // Grey
}

.lens-article .content-node.cover .subjects a:not(:last-child):after {
content: ', '
}
Expand Down

0 comments on commit 1bc10a0

Please sign in to comment.