<commit_before>
function ArticleObj(art) {
  this.title = art.title;
  this.imgName = art.imgName;
  this.imgPath = 'images/' + art.imgName + '.jpg';
  this.about = art.about;
  this.link = art.link;
  this.publishedOn = art.publishedOn;
  this.category = art.category;
  this.author = art.author;
  ArticleObj.all.push(this);
};

ArticleObj.all = []; //was articleContent?

ArticleObj.prototype.contentDisplay = function() {
  var templateIndex = $('#blogArticle').html();
  var template = Handlebars.compile(templateIndex);
  return template(this);
};

ArticleObj.prototype.setDates = function() {
  //Create method to make new dates
};

ArticleObj.checkLocal = function() {
  if (localStorage.rawData) {
    rawData = JSON.parse(localStorage.rawData);
    console.log('rawData from the localStorage is ' + rawData);
    ArticleObj.loadArticles(rawData);
  } else {
    ArticleObj.getRawData();
    console.log('rawData gotten from .json file');
  }
};

ArticleObj.loadArticles = function(rawData) {
  rawData.map(function(ele) {
    console.log(ele);
    return new ArticleObj(ele);
  });
};

ArticleObj.getRawData = function() {
  $.getJSON('data/article.json', function(rawData) {
    ArticleObj.loadArticles(rawData);
    localStorage.rawData = JSON.stringify(rawData);
  });
};

ArticleObj.checkLocal();

//
// articleDisplay.getFromServer = function () {
//   //use AJAX to get content form json file
// };
//
// articleDisplay.checkLatest = function() {
//   //getAjax head deal?
//   //Check to see if local storage is up to date.
// };

//Create a method to sort articles by date so that the most recent is presented first.

// $(document).ready(function() {
//   articles.forEach(function(ele){
//     var art = new ArticleObj(ele);
//   });

//   articleContent.forEach(function(ar) {
//     $('#projects').append(ar.contentDisplay());
//   });
// });<commit_msg>Updated render method. Articles from .json file display on page.<commit_after>
function ArticleObj(art) {
  this.title = art.title;
  this.imgName = art.imgName;
  this.imgPath = 'images/' + art.imgName + '.jpg';
  this.about = art.about;
  this.link = art.link;
  this.publishedOn = art.publishedOn;
  this.category = art.category;
  this.author = art.author;
  ArticleObj.all.push(this);
};

ArticleObj.all = []; //was articleContent?

ArticleObj.prototype.contentDisplay = function() {
  var templateIndex = $('#blogArticle').html();
  var template = Handlebars.compile(templateIndex);
  return template(this);
};

ArticleObj.prototype.setDates = function() {
  //Create method to make new dates
};

ArticleObj.checkLocal = function() {
  if (localStorage.rawData) {
    rawData = JSON.parse(localStorage.rawData);
    console.log('rawData from the localStorage is ' + rawData);
    ArticleObj.loadArticles(rawData);
  } else {
    ArticleObj.getRawData();
    console.log('rawData gotten from .json file');
  }
};

ArticleObj.loadArticles = function(rawData) {
  rawData.map(function(ele) {
    console.log(ele);
    return new ArticleObj(ele);
  });
};

ArticleObj.getRawData = function() {
  $.getJSON('data/article.json', function(rawData) {
    ArticleObj.loadArticles(rawData);
    localStorage.rawData = JSON.stringify(rawData);
  });
};



// articleDisplay.getFromServer = function () {
//   //use AJAX to get content form json file
// };
//
// articleDisplay.checkLatest = function() {
//   //getAjax head deal?
//   //Check to see if local storage is up to date.
// };

// Create a method to sort articles by date so that the most recent is presented first.

$(document).ready(function() {

  ArticleObj.checkLocal();

  ArticleObj.all.forEach(function(ar) {
    $('#projects').append(ar.contentDisplay());
  });
});
{'fraction_non_alphanumeric': 0.1548839719373988, 'fraction_numerical': 0.0, 'mean_word_length': 3.657035175879397, 'pattern_counts': {'":': 0, '<': 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': '2512856', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1162, 'n_words': 258}