protected function getBlockList(\DOMElement $element) {
    $lines = array();
    $prefix = $element->nodeName == 'ol' ? ' 1. ' : ' - ';
    // Markdown does not support definition lists, convert to ul.
    if ($element->nodeName == 'dl') {
      $newline = TRUE;
      /** @var \DOMElement $child */
      foreach ($element->childNodes as $child) {
        switch ($child->nodeName) {

          case 'dt':
            if ($newline) {
              $lines[] = $prefix . $this->getBlock($child);
            }
            else {
              $lines[count($lines) - 1] .= '<br/>' . $this->getBlock($child);
            }
            $newline = FALSE;
            break;

          case 'dd':
            $lines[count($lines) - 1] .= '<br/>' . $this->getBlock($child);
            $newline = TRUE;
            break;

        }
      }
    }
    else {
      /** @var \DOMElement $child */
      foreach ($element->childNodes as $child) {
        switch ($child->nodeName) {

          case 'li':
            $lines[] = $prefix . $this->getBlock($child);
            break;

        }
      }
    }
    return implode("\n", $lines);
  }
protected function getBlockList(\DOMElement $element) {
    $lines = array();
    $prefix = $element->nodeName == 'ol' ? ' 1. ' : ' - ';
    // Markdown does not support definition lists, convert to ul.
    if ($element->nodeName == 'dl') {
      $newline = TRUE;
      /** @var \DOMElement $child */
      foreach ($element->childNodes as $child) {
        switch ($child->nodeName) {

          case 'dt':
            if ($newline) {
              $lines[] = $prefix . $this->getBlock($child);
            }
            else {
              $lines[count($lines) - 1] .= '<br/>' . $this->getBlock($child);
            }
            $newline = FALSE;
            break;

          case 'dd':
            $lines[count($lines) - 1] .= '<br/>' . $this->getBlock($child);
            $newline = TRUE;
            break;

        }
      }
    }
    else {
      /** @var \DOMElement $child */
      foreach ($element->childNodes as $child) {
        switch ($child->nodeName) {

          case 'li':
            $lines[] = $prefix . $this->getBlock($child);
            break;

        }
      }
    }
    return implode("\n", $lines);
  }
protected function getBlockList ( \ DOMElement $ element ) { $ lines = array ( ) ; $ prefix = $ element -> nodeName == 'ol' ? ' 1. ' : ' - ' ; // Markdown does not support definition lists, convert to ul. if ( $ element -> nodeName == 'dl' ) { $ newline = TRUE ; /** @var \DOMElement $child */ foreach ( $ element -> childNodes as $ child ) { switch ( $ child -> nodeName ) { case 'dt' : if ( $ newline ) { $ lines [ ] = $ prefix . $ this -> getBlock ( $ child ) ; } else { $ lines [ count ( $ lines ) - 1 ] .= '<br/>' . $ this -> getBlock ( $ child ) ; } $ newline = FALSE ; break ; case 'dd' : $ lines [ count ( $ lines ) - 1 ] .= '<br/>' . $ this -> getBlock ( $ child ) ; $ newline = TRUE ; break ; } } } else { /** @var \DOMElement $child */ foreach ( $ element -> childNodes as $ child ) { switch ( $ child -> nodeName ) { case 'li' : $ lines [ ] = $ prefix . $ this -> getBlock ( $ child ) ; break ; } } } return implode ( "\n" , $ lines ) ; }
Converts a list-type \DOMElement into a single Markdown block.

Note Apple markdown subset does not support nested lists.

@param \DOMElement $element
One of ul, ol, dl.

@return string
A single Markdown block string.
Converts a list - type \ DOMElement into a single Markdown block .