Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change decision letter parsing for eLife articles. #224

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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