app/functions/contentProcessors.js
function processMeta (markdownContent) {
  let meta = {};
  let metaArr;
  let metaString;
  let metas;

  let yamlObject;

  switch (true) {
    case _metaRegex.test(markdownContent):
      metaArr = markdownContent.match(_metaRegex);
      metaString = metaArr ? metaArr[1].trim() : '';

      if (metaString) {
        metas = metaString.match(/(.*): (.*)/ig);
        metas.forEach(item => {
          const parts = item.split(': ');
          if (parts[0] && parts[1]) {
            meta[cleanString(parts[0], true)] = parts[1].trim();
          }
        });
      }
      break;

    case _metaRegexYaml.test(markdownContent):
      metaArr = markdownContent.match(_metaRegexYaml);
      metaString = metaArr ? metaArr[1].trim() : '';
      yamlObject = yaml.safeLoad(metaString);
      meta = cleanObjectStrings(yamlObject);
      break;

    default:
    // No meta information
  }

  return meta;
}
function processMeta (markdownContent) {
  let meta = {};
  let metaArr;
  let metaString;
  let metas;

  let yamlObject;

  switch (true) {
    case _metaRegex.test(markdownContent):
      metaArr = markdownContent.match(_metaRegex);
      metaString = metaArr ? metaArr[1].trim() : '';

      if (metaString) {
        metas = metaString.match(/(.*): (.*)/ig);
        metas.forEach(item => {
          const parts = item.split(': ');
          if (parts[0] && parts[1]) {
            meta[cleanString(parts[0], true)] = parts[1].trim();
          }
        });
      }
      break;

    case _metaRegexYaml.test(markdownContent):
      metaArr = markdownContent.match(_metaRegexYaml);
      metaString = metaArr ? metaArr[1].trim() : '';
      yamlObject = yaml.safeLoad(metaString);
      meta = cleanObjectStrings(yamlObject);
      break;

    default:
    // No meta information
  }

  return meta;
}
function processMeta ( markdownContent ) { let meta = { } ; let metaArr ; let metaString ; let metas ; let yamlObject ; switch ( true ) { case _metaRegex . test ( markdownContent ) : metaArr = markdownContent . match ( _metaRegex ) ; metaString = metaArr ? metaArr [ 1 ] . trim ( ) : '' ; if ( metaString ) { metas = metaString . match ( / (.*): (.*) / ig ) ; metas . forEach ( item => { const parts = item . split ( ': ' ) ; if ( parts [ 0 ] && parts [ 1 ] ) { meta [ cleanString ( parts [ 0 ] , true ) ] = parts [ 1 ] . trim ( ) ; } } ) ; } break ; case _metaRegexYaml . test ( markdownContent ) : metaArr = markdownContent . match ( _metaRegexYaml ) ; metaString = metaArr ? metaArr [ 1 ] . trim ( ) : '' ; yamlObject = yaml . safeLoad ( metaString ) ; meta = cleanObjectStrings ( yamlObject ) ; break ; default : // No meta information } return meta ; }
Get meta information from Markdown content
Get meta information from Markdown content