You are here

function Markdown_Parser::prepareItalicsAndBold in Markdown 5

Same name and namespace in other branches
  1. 6 markdown.php \Markdown_Parser::prepareItalicsAndBold()
1 call to Markdown_Parser::prepareItalicsAndBold()
Markdown_Parser::Markdown_Parser in ./markdown.php

File

./markdown.php, line 1131

Class

Markdown_Parser

Code

function prepareItalicsAndBold() {

  #

  # Prepare regular expressions for seraching emphasis tokens in any

  # context.

  #
  foreach ($this->em_relist as $em => $em_re) {
    foreach ($this->strong_relist as $strong => $strong_re) {

      # Construct list of allowed token expressions.
      $token_relist = array();
      if (isset($this->em_strong_relist["{$em}{$strong}"])) {
        $token_relist[] = $this->em_strong_relist["{$em}{$strong}"];
      }
      $token_relist[] = $em_re;
      $token_relist[] = $strong_re;

      # Construct master expression from list.
      $token_re = '{(' . implode('|', $token_relist) . ')}';
      $this->em_strong_prepared_relist["{$em}{$strong}"] = $token_re;
    }
  }
}