/*
Private: Construct url for article from title and category label

Returns string
353584
private function constructURL()
    {
        $cat = $this->getCategory()->getCat();
        $dashed = $this->getUrlisedTitle();
        $output = $cat.'/'.$this->getId().'/'.$dashed.'/'; // output: CAT/ID/TITLE/
        return $output;
    }
95149
def help_center_articles_label_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/help_center/articles/labels/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
271717
function (header) {
      var links = {};

      if (header && header.length) {
        // Split parts by comma
        var parts = header.split(',');
        // Parse each part into a named link
        for (var i = 0; i < parts.length; i++) {
          var section = parts[i].split(';');
          if (section.length !== 2) {
            throw new Error("section could not be split on ';'");
          }
          var url = section[0].replace(/<(.*)>/, '$1').trim();
          var name = section[1].replace(/rel="(.*)"/, '$1').trim();
          links[name] = url;
        }
      }

      return links;
    }
227557
def category(self, category):
        
        self.url.category = category
        self.url.set_page(1)
        return self
1044117
def category(self, category=None):
        
        if category is None:
            return int(self.url.category)
        self.url.category = str(category)
660575
def make_link(title, url, blank=False):
	
	attrs = 'href="%s"' % url
	if blank:
		attrs += ' target="_blank" rel="noopener noreferrer"'
	return '<a %s>%s</a>' % (attrs, title)
204451
def get_content_title(self, obj):
        """"""
        return Content.objects.get(id=obj.content.id).title
580481
function(apiKey, pieceTitle, categories,
        fromAddress, toAddress, ccAddress, bccAddress, subject, textBody,
        htmlBody, contentType, mergeContext) {}
971236
def get_title(self):
        
        if self.category == 'cable':
            strings = get_strings(self.soup, 'strong')
        else:
            strings = get_strings(self.soup, 'b')

        if len(strings) == 0:
            strings = get_strings(self.soup, 'strong')

        if len(strings) >= 1 and self.category == 'cable':
            return strings[0]
        elif len(strings) > 0 and 'Fast' in strings[-1]:
            return strings[0]

        return ''.join(strings)
187198
protected function generateCategoryUrl()
    {
        /** @var $target PageModel */
        if ($this->jumpTo && ($target = $this->objModel->getRelated('jumpTo')) instanceof PageModel) {
            $page = $target;
        } else {
            $page = $GLOBALS['objPage'];
        }

        $manager = System::getContainer()->get('codefog_news_categories.manager');

        /** @var NewsCategoryModel $category */
        $category = NewsCategoryModel::findPublishedByIdOrAlias(Input::get($manager->getParameterName()));

        // Generate the category URL
        if ($category !== null) {
            $url = $manager->generateUrl($category, $page);
        } else {
            // Generate the regular URL
            $url = $page->getFrontendUrl();
        }

        return $url;
    }
925050
function filterTitle(posts) {
      var reTitle = title.map(function makeRE(word) {
        return new RegExp(word, 'i');
      });

      return posts.filter(function filterPosts(post) {
        return reTitle.every(function checkRE(regex) {
          return regex.test(post.title) || regex.test(post.slug);
        });
      });
    }
775431
function getSectionName(article) {
  const { tiles } = article;

  if (!tiles) {
    return null;
  }

  const slices = tiles.reduce((acc, tile) => {
    acc.push(...tile.slices);
    return acc;
  }, []);
  const sections = slices.reduce((acc, slice) => {
    acc.push(...slice.sections);
    return acc;
  }, []);
  const titles = sections.map(section => section.title);

  if (titles.length === 0) {
    return null;
  }

  const nonNews = titles.filter(title => title !== "News");

  return nonNews.length ? nonNews[0] : "News";
}
987124
function() {
  var title = this.match(reLinkTitle);
  if (title) {
    // chop off quotes from title and unescape:
    return unescape(title.substr(1, title.length - 2));
  } else {
    return null;
  }
}
672138
def anchor(parser, token):
    
    bits = [b for b in token.split_contents()]
    if len(bits) < 2:
        raise template.TemplateSyntaxError("anchor tag takes at least 1 argument.")

    title_is_var = False
    try:
        title = bits[2]
        if title[0] in ('"', "'"):
            if title[0] == title[-1]:
                title = title[1:-1]
            else:
                raise template.TemplateSyntaxError(
                    'anchor tag title must be a "string", _("trans string"), or variable'
                )
        elif title.startswith('_("') or title.startswith("_('"):
            title = _(title[3:-2])
        else:
            title_is_var = True
    except IndexError:
        title = bits[1].capitalize()

    return SortAnchorNode(bits[1].strip(), title.strip(), title_is_var)
1351218
function(category) {
			var settings  = this.getSettings(category);
			for (var i = 0; i < settings.length; i++){
				var label = settings[i].getCategoryLabel();
				if (label) {
					return label;
				}
			}
			return null;
		}
1033042
function parseLink (text) {
  if (!text) return ''
  var results = []
  var matches = null
  var link1 = /{@link (\S+?)}/g // {@link someSymbol}
  var link2 = /\[(.+?)\]{@link (\S+?)}/g // [caption here]{@link someSymbol}
  var link3 = /{@link ([^\s}]+?)\|(.+?)}/g // {@link someSymbol|caption here}
  var link4 = /{@link ([^\s}\|]+?) (.+?)}/g // {@link someSymbol Caption Here}

  while ((matches = link4.exec(text)) !== null) {
    results.push({
      original: matches[0],
      caption: matches[2],
      url: matches[1]
    })
    text = text.replace(matches[0], Buffer(matches[0].length).fill(' ').toString())
  }

  while ((matches = link3.exec(text)) !== null) {
    results.push({
      original: matches[0],
      caption: matches[2],
      url: matches[1]
    })
    text = text.replace(matches[0], Buffer(matches[0].length).fill(' ').toString())
  }

  while ((matches = link2.exec(text)) !== null) {
    results.push({
      original: matches[0],
      caption: matches[1],
      url: matches[2]
    })
    text = text.replace(matches[0], Buffer(matches[0].length).fill(' ').toString())
  }

  while ((matches = link1.exec(text)) !== null) {
    results.push({
      original: matches[0],
      caption: matches[1],
      url: matches[1]
    })
    text = text.replace(matches[0], Buffer(matches[0].length).fill(' ').toString())
  }
  return results
}
1308839
function makeLinks (links, item) {
  var retLinks = {}

  _.each(links, function (value, name) {
    if (_.isFunction(value)) {
      retLinks[name] = value(item)
    } else {
      retLinks[name] = _(value).toString()
    }
  })

  return retLinks
}