<commit_before>"use strict";

var util = require("substance-util");

var DefaultConfiguration = require('./default');

var ElifeConfiguration = function() {

};

ElifeConfiguration.Prototype = function() {

  // Resolves figure url
  // --------
  //

  this.enhanceFigure = function(state, node, element) {
    var graphic = element.querySelector("graphic");
    var url = graphic.getAttribute("xlink:href");

    // Example url to SVG: http://cdn.elifesciences.org/elife-articles/00768/svg/elife00768f001.svg
    url = [
      "http://cdn.elifesciences.org/elife-articles/",
      state.doc.id,
      "/svg/",
      url,
      ".svg"
    ].join('');

    node.url = url;
  };

  this.enhanceVideo = function(state, node, element) {
    var el = element.querySelector("media") || element;
    var href = element.getAttribute("xlink:href").split(".");
    var name = href[0];

    node.url = "http://static.movie-usa.glencoesoftware.com/mp4/10.7554/"+name+".mp4";
    node.url_ogv = "http://static.movie-usa.glencoesoftware.com/ogv/10.7554/"+name+".ogv";
    node.url_webm = "http://static.movie-usa.glencoesoftware.com/webm/10.7554/"+name+".webm";
    node.poster = "http://static.movie-usa.glencoesoftware.com/jpg/10.7554/"+name+".jpg";
  };

  // Add additional information to the info view
  // ---------
  //
  // Impact
  // Major datasets
  // Acknowledgements
  // Copyright

  this.enhanceInfo = function(converter, state, article) {
    var doc = state.doc;
    var articleInfo = {
      "id": "articleinfo",
      "type": "paragraph",
      "children": []
    };
    var nodes = articleInfo["children"];

    console.log('start the fun')
    // var impact = article.querySelector("custom-meta");
    // if (impact) {
    //   var h1 = {
    //     "type": "heading",
    //     "id": state.nextId("heading"),
    //     "level": 1,
    //     "content": "Impact",
    //   };

    //   var t1 = {
    //     "type": "text",
    //     "id": state.nextId("text"),
    //     "content": impact.textContent,
    //   };
    //   console.log(impact.textContent)
    //   doc.create(h1);
    //   doc.create(t1);
    //   nodes.push(h1);
    //   nodes.push(t1);
    //   nodes = nodes.concat(converter.bodyNodes(state, util.dom.getChildren(body)));
    // }
    // Using the caption node type until we have our RichParagraph ready
    
    var license = article.querySelector("permissions");
    if (license) {
      var h1 = {
        "type" : "heading",
        "id" : state.nextId("heading"),
        "level" : 1,
        "content" : "Copyright and License"
      };
      doc.create(h1);
      nodes.push(h1);

      var copyright = license.querySelector("copyright-statement");
      if (copyright) {
        var t1 = {
          "type" : "text",
          "id" : state.nextId("text"),
          "content" : copyright.textContent
        };
        console.log(copyright.textContent)
        doc.create(t1);
        nodes.push(t1);
      }
      //var para = license.querySelector("p");
      
      
    }
    doc.create(articleInfo);
    doc.show("info", articleInfo.id);
  };

  // Add Decision letter and author response
  // ---------
<commit_msg>add nodes to body<commit_after>"use strict";

var util = require("substance-util");

var DefaultConfiguration = require('./default');

var ElifeConfiguration = function() {

};

ElifeConfiguration.Prototype = function() {

  // Resolves figure url
  // --------
  //

  this.enhanceFigure = function(state, node, element) {
    var graphic = element.querySelector("graphic");
    var url = graphic.getAttribute("xlink:href");

    // Example url to SVG: http://cdn.elifesciences.org/elife-articles/00768/svg/elife00768f001.svg
    url = [
      "http://cdn.elifesciences.org/elife-articles/",
      state.doc.id,
      "/svg/",
      url,
      ".svg"
    ].join('');

    node.url = url;
  };

  this.enhanceVideo = function(state, node, element) {
    var el = element.querySelector("media") || element;
    var href = element.getAttribute("xlink:href").split(".");
    var name = href[0];

    node.url = "http://static.movie-usa.glencoesoftware.com/mp4/10.7554/"+name+".mp4";
    node.url_ogv = "http://static.movie-usa.glencoesoftware.com/ogv/10.7554/"+name+".ogv";
    node.url_webm = "http://static.movie-usa.glencoesoftware.com/webm/10.7554/"+name+".webm";
    node.poster = "http://static.movie-usa.glencoesoftware.com/jpg/10.7554/"+name+".jpg";
  };

  // Add additional information to the info view
  // ---------
  //
  // Impact
  // Major datasets
  // Acknowledgements
  // Copyright

  this.enhanceInfo = function(converter, state, article) {
    var doc = state.doc;
    var articleInfo = {
      "id": "articleinfo",
      "type": "paragraph",
      "children": []
    };
    var nodes = articleInfo["children"];

    console.log('start the fun')
    // var impact = article.querySelector("custom-meta");
    // if (impact) {
    //   var h1 = {
    //     "type": "heading",
    //     "id": state.nextId("heading"),
    //     "level": 1,
    //     "content": "Impact",
    //   };

    //   var t1 = {
    //     "type": "text",
    //     "id": state.nextId("text"),
    //     "content": impact.textContent,
    //   };
    //   console.log(impact.textContent)
    //   doc.create(h1);
    //   doc.create(t1);
    //   nodes.push(h1);
    //   nodes.push(t1);
    //   nodes = nodes.concat(converter.bodyNodes(state, util.dom.getChildren(body)));
    // }
    // Using the caption node type until we have our RichParagraph ready
    
    var license = article.querySelector("permissions");
    if (license) {
      var h1 = {
        "type" : "heading",
        "id" : state.nextId("heading"),
        "level" : 1,
        "content" : "Copyright and License"
      };
      doc.create(h1);
      nodes.push(h1);

      var copyright = license.querySelector("copyright-statement");
      if (copyright) {
        var t1 = {
          "type" : "text",
          "id" : state.nextId("text"),
          "content" : copyright.textContent
        };
        console.log(copyright.textContent)
        doc.create(t1);
        nodes.push(t1);
      }
      //var para = license.querySelector("p");
      
      nodes = nodes.concat(converter.bodyNodes(state, util.dom.getChildren(body)));
    }
    doc.create(articleInfo);
    doc.show("info", articleInfo.id);
  };

  // Add Decision letter and author response
  // ---------

{'fraction_non_alphanumeric': 0.18115150569511623, 'fraction_numerical': 0.01685130285535965, 'mean_word_length': 2.2098147220831246, 'pattern_counts': {'":': 20, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3487787', 'n_tokens_mistral': 2181, 'n_tokens_neox': 2092, 'n_words': 372}