Skip to content

Commit

Permalink
Merge pull request #224 from elifesciences/elife-decision-letter
Browse files Browse the repository at this point in the history
Change decision letter parsing for eLife articles.
  • Loading branch information
gnott authored Mar 25, 2021
2 parents d302339 + 29bfd7e commit 1d7d003
Showing 1 changed file with 16 additions and 35 deletions.
51 changes: 16 additions & 35 deletions converter/elife_converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,42 +40,23 @@ ElifeConverter.Prototype = function() {
var doc = state.doc;
var heading, body;

// Decision letter (if available)
// Decision letter and author response sub articles (if available)
// -----------

var articleCommentary = article.querySelector("#SA1");
if (articleCommentary) {
heading = {
id: state.nextId("heading"),
type: "heading",
level: 1,
content: "Decision letter"
};
doc.create(heading);
nodes.push(heading);

body = articleCommentary.querySelector("body");
nodes = nodes.concat(this.bodyNodes(state, util.dom.getChildren(body)));
}

// Author response
// -----------

var authorResponse = article.querySelector("#SA2");
if (authorResponse) {

heading = {
id: state.nextId("heading"),
type: "heading",
level: 1,
content: "Author response"
};
doc.create(heading);
nodes.push(heading);

body = authorResponse.querySelector("body");
nodes = nodes.concat(this.bodyNodes(state, util.dom.getChildren(body)));
}
var subArticles = article.querySelectorAll("sub-article");
_.each(subArticles, function(subArticle) {
var subArticleTitle = subArticle.querySelector("title-group article-title").textContent;
heading = {
id: state.nextId("heading"),
type: "heading",
level: 1,
content: subArticleTitle
};
doc.create(heading);
nodes.push(heading);

body = subArticle.querySelector("body");
nodes = nodes.concat(this.bodyNodes(state, util.dom.getChildren(body)));
}.bind(this));

// Show them off
// ----------
Expand Down

0 comments on commit 1d7d003

Please sign in to comment.