Markdownify\ConverterExtra::__construct PHP Метод

__construct() публичный Метод

constructor, see Markdownify::Markdownify() for more information
public __construct ( $linksAfterEachParagraph = self::LINK_AFTER_CONTENT, $bodyWidth = MDFY_BODYWIDTH, $keepHTML = MDFY_KEEPHTML )
    public function __construct($linksAfterEachParagraph = self::LINK_AFTER_CONTENT, $bodyWidth = MDFY_BODYWIDTH, $keepHTML = MDFY_KEEPHTML)
    {
        parent::__construct($linksAfterEachParagraph, $bodyWidth, $keepHTML);
        // new markdownable tags & attributes
        // header ids: # foo {bar}
        $this->isMarkdownable['h1']['id'] = 'optional';
        $this->isMarkdownable['h1']['class'] = 'optional';
        $this->isMarkdownable['h2']['id'] = 'optional';
        $this->isMarkdownable['h2']['class'] = 'optional';
        $this->isMarkdownable['h3']['id'] = 'optional';
        $this->isMarkdownable['h3']['class'] = 'optional';
        $this->isMarkdownable['h4']['id'] = 'optional';
        $this->isMarkdownable['h4']['class'] = 'optional';
        $this->isMarkdownable['h5']['id'] = 'optional';
        $this->isMarkdownable['h5']['class'] = 'optional';
        $this->isMarkdownable['h6']['id'] = 'optional';
        $this->isMarkdownable['h6']['class'] = 'optional';
        // tables
        $this->isMarkdownable['table'] = array();
        $this->isMarkdownable['th'] = array('align' => 'optional');
        $this->isMarkdownable['td'] = array('align' => 'optional');
        $this->isMarkdownable['tr'] = array();
        array_push($this->ignore, 'thead');
        array_push($this->ignore, 'tbody');
        array_push($this->ignore, 'tfoot');
        // definition lists
        $this->isMarkdownable['dl'] = array();
        $this->isMarkdownable['dd'] = array();
        $this->isMarkdownable['dt'] = array();
        // link class
        $this->isMarkdownable['a']['id'] = 'optional';
        $this->isMarkdownable['a']['class'] = 'optional';
        // footnotes
        $this->isMarkdownable['fnref'] = array('target' => 'required');
        $this->isMarkdownable['footnotes'] = array();
        $this->isMarkdownable['fn'] = array('name' => 'required');
        $this->parser->blockElements['fnref'] = false;
        $this->parser->blockElements['fn'] = true;
        $this->parser->blockElements['footnotes'] = true;
        // abbr
        $this->isMarkdownable['abbr'] = array('title' => 'required');
        // build RegEx lookahead to decide wether table can pe parsed or not
        $inlineTags = array_keys($this->parser->blockElements, false);
        $colContents = '(?:[^<]|<(?:' . implode('|', $inlineTags) . '|[^a-z]))*';
        $this->tableLookaheadHeader = '{
    ^\\s*(?:<thead\\s*>)?\\s*                                  # open optional thead
      <tr\\s*>\\s*(?:                                         # start required row with headers
        <th(?:\\s+align=("|\')(?:left|center|right)\\1)?\\s*>  # header with optional align
        \\s*' . $colContents . '\\s*                              # contents
        </th>\\s*                                            # close header
      )+</tr>                                               # close row with headers
    \\s*(?:</thead>)?                                        # close optional thead
    }sxi';
        $this->tdSubstitute = '\\s*' . $colContents . '\\s*           # contents
          </td>\\s*';
        $this->tableLookaheadBody = '{
      \\s*(?:<tbody\\s*>)?\\s*                                 # open optional tbody
        (?:<tr\\s*>\\s*                                       # start row
          %s                                                # cols to be substituted
        </tr>)+                                             # close row
      \\s*(?:</tbody>)?                                      # close optional tbody
    \\s*</table>                                             # close table
    }sxi';
    }