[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Plugins/Litedown/Parser/ -> LinkAttributesSetter.js (source)

   1  /**
   2  * Set a URL or IMG tag's attributes
   3  *
   4  * @param {!Tag}    tag      URL or IMG tag
   5  * @param {string} linkInfo Link's info: an URL optionally followed by spaces and a title
   6  * @param {string} attrName Name of the URL attribute
   7  */
   8  function setLinkAttributes(tag, linkInfo, attrName)
   9  {
  10      var url   = linkInfo.replace(/^\s*/, '').replace(/\s*$/, ''),
  11          title = '',
  12          pos   = url.indexOf(' ');
  13      if (pos !== -1)
  14      {
  15          title = url.substring(pos).replace(/^\s*\S/, '').replace(/\S\s*$/, '');
  16          url   = url.substring(0, pos);
  17      }
  18      if (/^<.+>$/.test(url))
  19      {
  20          url = url.replace(/^<(.+)>$/, '$1').replace(/\\>/g, '>');
  21      }
  22  
  23      tag.setAttribute(attrName, decode(url));
  24      if (title > '')
  25      {
  26          tag.setAttribute('title', decode(title));
  27      }
  28  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1