index.js
function parseShortcode(innerShortcode) {
  var trimmedInnerShortcode = innerShortcode.trim();

  // If no shortcode, it was blank between the blocks - return nothing.
  if (!trimmedInnerShortcode) return;

  // If no whitespace, then shortcode is just name with no attributes.
  if (!hasWhiteSpace(trimmedInnerShortcode)) {
    return { identifier: trimmedInnerShortcode, attributes: {} };
  }

  var splitShortcode = trimmedInnerShortcode.match(/^(\S+)\s(.*)/).slice(1);
  var shortcodeName = splitShortcode[0];
  var attributeString = splitShortcode[1];
  var attributes = parseShortcodeAttributes(attributeString);

  // If no attributes parsed, something went wrong - return nothing.
  if (!attributes) return;

  return {
    identifier: shortcodeName,
    attributes: attributes
  };
}
function parseShortcode(innerShortcode) {
  var trimmedInnerShortcode = innerShortcode.trim();

  // If no shortcode, it was blank between the blocks - return nothing.
  if (!trimmedInnerShortcode) return;

  // If no whitespace, then shortcode is just name with no attributes.
  if (!hasWhiteSpace(trimmedInnerShortcode)) {
    return { identifier: trimmedInnerShortcode, attributes: {} };
  }

  var splitShortcode = trimmedInnerShortcode.match(/^(\S+)\s(.*)/).slice(1);
  var shortcodeName = splitShortcode[0];
  var attributeString = splitShortcode[1];
  var attributes = parseShortcodeAttributes(attributeString);

  // If no attributes parsed, something went wrong - return nothing.
  if (!attributes) return;

  return {
    identifier: shortcodeName,
    attributes: attributes
  };
}
function parseShortcode ( innerShortcode ) { var trimmedInnerShortcode = innerShortcode . trim ( ) ; // If no shortcode, it was blank between the blocks - return nothing. if ( ! trimmedInnerShortcode ) return ; // If no whitespace, then shortcode is just name with no attributes. if ( ! hasWhiteSpace ( trimmedInnerShortcode ) ) { return { identifier : trimmedInnerShortcode , attributes : { } } ; } var splitShortcode = trimmedInnerShortcode . match ( / ^(\S+)\s(.*) / ) . slice ( 1 ) ; var shortcodeName = splitShortcode [ 0 ] ; var attributeString = splitShortcode [ 1 ] ; var attributes = parseShortcodeAttributes ( attributeString ) ; // If no attributes parsed, something went wrong - return nothing. if ( ! attributes ) return ; return { identifier : shortcodeName , attributes : attributes } ; }
Parses the inner shortcode to extract shortcode name & key-value attributes.
@param {string} innerShortcode - Extracted shortcode from between the start & end blocks.
Parses the inner shortcode to extract shortcode name & key - value attributes .