diff --git a/libs/ContentTypes/Markdown/ContentType.php b/libs/ContentTypes/Markdown/ContentType.php index f13ce88..01ebf9e 100644 --- a/libs/ContentTypes/Markdown/ContentType.php +++ b/libs/ContentTypes/Markdown/ContentType.php @@ -18,7 +18,7 @@ class ContentType implements \Todaymade\Daux\ContentTypes\ContentType } /** - * @return array + * @return string[] */ public function getExtensions() { diff --git a/libs/ContentTypes/Markdown/LinkRenderer.php b/libs/ContentTypes/Markdown/LinkRenderer.php index bdd3b34..4d9844e 100644 --- a/libs/ContentTypes/Markdown/LinkRenderer.php +++ b/libs/ContentTypes/Markdown/LinkRenderer.php @@ -1,7 +1,7 @@ addId($node); - - $headings[] = new Entry($node, $id); + $this->ensureHeadingHasId($node); + $headings[] = new Entry($node); } if (count($headings) && (count($tocs) || $this->hasAutoTOC())) { @@ -73,14 +72,17 @@ class Processor implements DocumentProcessorInterface } } - protected function addId(Heading $node) + /** + * @param Heading $node + */ + protected function ensureHeadingHasId(Heading $node) { // If the node has an ID, no need to generate it $attributes = $node->getData('attributes', []); if (array_key_exists('id', $attributes) && !empty($attributes['id'])) { // TODO :: check for uniqueness - return $attributes['id']; + return; } // Well, seems we have to generate an ID @@ -186,7 +188,13 @@ class Processor implements DocumentProcessorInterface return $list; } - protected function setNull($object, $property) + /** + * Set the specified property to null on the object. + * + * @param Heading $object The object to modify + * @param string $property The property to nullify + */ + protected function setNull(Heading $object, $property) { $prop = new \ReflectionProperty(get_class($object), $property); $prop->setAccessible(true); diff --git a/libs/Format/HTML/Generator.php b/libs/Format/HTML/Generator.php index 49d23cc..a52e53e 100755 --- a/libs/Format/HTML/Generator.php +++ b/libs/Format/HTML/Generator.php @@ -4,10 +4,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Todaymade\Daux\Config; use Todaymade\Daux\Console\RunAction; -use Todaymade\Daux\Format\HTML\ContentTypes\Markdown\ContentType; use Todaymade\Daux\Daux; use Todaymade\Daux\DauxHelper; use Todaymade\Daux\Format\Base\LiveGenerator; +use Todaymade\Daux\Format\HTML\ContentTypes\Markdown\ContentType; use Todaymade\Daux\GeneratorHelper; use Todaymade\Daux\Tree\ComputedRaw; use Todaymade\Daux\Tree\Directory; @@ -85,6 +85,9 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator, LiveGenerator * block-level tags to prevent word joining after tag removal. * Also collapse whitespace to single space and trim result. * modified from: http://nadeausoftware.com/articles/2007/09/php_tip_how_strip_html_tags_web_page + * + * @param string $text + * @return string */ private function strip_html_tags($text) { diff --git a/libs/Format/HTMLFile/Generator.php b/libs/Format/HTMLFile/Generator.php index 35f4a26..5fbdb05 100644 --- a/libs/Format/HTMLFile/Generator.php +++ b/libs/Format/HTMLFile/Generator.php @@ -3,8 +3,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Todaymade\Daux\Console\RunAction; -use Todaymade\Daux\Format\HTML\ContentTypes\Markdown\ContentType; use Todaymade\Daux\Daux; +use Todaymade\Daux\Format\HTML\ContentTypes\Markdown\ContentType; class Generator implements \Todaymade\Daux\Format\Base\Generator {