Skip to content

Commit

Permalink
Merge pull request #1560 from joebordes/hacktoberfest20233
Browse files Browse the repository at this point in the history
fix(GenDoc) support bullet lists inside sections
  • Loading branch information
joebordes authored Oct 26, 2023
2 parents cc02e55 + 4219dbe commit 79e4332
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/evvtgendoc/OpenDocument/List.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public function __construct(DOMNode $node, OpenDocument $document, $contnum = ''
$this->continuenum = $continuenum;
}

$this->allowedElements = array();
$this->allowedElements = array(
'OpenDocument_ListItem',
);
}

/**
Expand Down Expand Up @@ -190,6 +192,9 @@ public function createListItem($text = '') {
* @access public
*/
public function getChildren() {
if (empty($this->children)) {
$this->listChildren();
}
return $this->children->getIterator();
}
}
Expand Down
17 changes: 17 additions & 0 deletions modules/evvtgendoc/OpenDocument/ListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ class OpenDocument_ListItem extends OpenDocument_StyledElement {
*/
const styleNamePrefix = 'L';

/**
* Constructor
*
* @param DOMNode $node
* @param OpenDocument $document
*/
public function __construct(DOMNode $node, OpenDocument $document) {
parent::__construct($node, $document);
$this->allowedElements = array(
'OpenDocument_Paragraph',
'OpenDocument_Span',
);
}

/**
* Create element instance
*
Expand Down Expand Up @@ -174,6 +188,9 @@ public function createHeading($text = '', $level = 1) {
* @access public
*/
public function getChildren() {
if (empty($this->children)) {
$this->listChildren();
}
return $this->children->getIterator();
}
}
Expand Down
5 changes: 5 additions & 0 deletions modules/evvtgendoc/OpenDocument/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function __construct(DOMNode $node, OpenDocument $document) {
'OpenDocument_Span',
'OpenDocument_Paragraph',
'OpenDocument_Heading',
'OpenDocument_List',
);
}

Expand Down Expand Up @@ -125,5 +126,9 @@ public function createSpan($text) {
public function createHeading($text = '', $level = 1) {
return OpenDocument_Heading::instance($this, $text, $level);
}

public function createList() {
return OpenDocument_List::instance($this);
}
}
?>

0 comments on commit 79e4332

Please sign in to comment.