-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
6,464 additions
and
1,641 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Argument | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Changelog | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Changelog Factory | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Default Printer | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Documentor | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
@@ -32,11 +32,19 @@ class Documentor { | |
*/ | ||
private $hooks; | ||
|
||
/** | ||
* Prefixes. | ||
* | ||
* @var string[] | ||
*/ | ||
public $prefixes; | ||
|
||
/** | ||
* Construct documentor. | ||
*/ | ||
public function __construct() { | ||
$this->hooks = array(); | ||
$this->hooks = array(); | ||
$this->prefixes = array(); | ||
} | ||
|
||
/** | ||
|
@@ -91,6 +99,26 @@ public function relative( \SplFileInfo $file ) { | |
return \trim( $filesystem->makePathRelative( $end->getRealPath(), $start->getRealPath() ), '/' ); | ||
} | ||
|
||
/** | ||
* Check if the specified tag name should be parsed. | ||
* | ||
* @param string $name Tag name. | ||
* @return bool True if should parse, false otherwise. | ||
*/ | ||
private function should_parse_tag( $name ) { | ||
if ( 0 === \count( $this->prefixes ) ) { | ||
return true; | ||
} | ||
|
||
foreach ( $this->prefixes as $prefix ) { | ||
if ( \str_starts_with( $name, $prefix ) ) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Parse. | ||
* | ||
|
@@ -173,24 +201,19 @@ function( Node $node ) { | |
); | ||
} | ||
|
||
if ( ! is_null( $this->prefix ) ) { | ||
$pattern = sprintf( '/^(%s)/', implode( '|', explode( ',', $this->prefix ) ) ); | ||
preg_match( $pattern, $tag_name, $matches ); | ||
|
||
if ( empty( $matches ) ) { | ||
continue; | ||
} | ||
if ( ! $this->should_parse_tag( $tag_name ) ) { | ||
continue; | ||
} | ||
|
||
$tag = new Tag( $tag_name, $tag_arg ); | ||
|
||
$doc_comment = $statement->getDocComment(); | ||
|
||
if ( null === $doc_comment ) { | ||
$previous = $statement->getAttribute( 'previous' ); | ||
$parent = $statement->getAttribute( 'parent' ); | ||
|
||
if ( null !== $previous ) { | ||
$doc_comment = $previous->getDocComment(); | ||
if ( null !== $parent ) { | ||
$doc_comment = $parent->getDocComment(); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Hook | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Hookster Printer | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Namespace Resolver | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Since | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Tag | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Tag Printer | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Template Printer | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* | ||
* @link https://github.com/themeblvd/hookster | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* | ||
* @link https://guides.github.com/features/mastering-markdown/ | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
@@ -70,7 +70,7 @@ | |
printf( | ||
'<em>Generated by <a href="%s">Pronamic WordPress Documentor</a> <code>%s</code></em>', | ||
'https://github.com/pronamic/wp-documentor', | ||
'1.1.1' | ||
'1.2.0' | ||
); | ||
|
||
echo '<p>'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Markdown Hook Template. | ||
* | ||
* @author Pronamic <[email protected]> | ||
* @copyright 2005-2021 Pronamic | ||
* @copyright 2005-2022 Pronamic | ||
* @license GPL-3.0-or-later | ||
* @package Pronamic\WordPress\Documentor | ||
*/ | ||
|
Oops, something went wrong.