RestructuredTextFormatter
namespace |
bhenk\doc2rst\format |
predicates |
Cloneable | Instantiable |
implements |
|
extends |
|
hierarchy |
This RestructuredTextFormatter is handling literal reStructuredText
This formatter is started with 3 tics on a new line, followed by rst. Optionally this is followed by a command followed by zero or more parameters. The block is ended with 3 tics on a new line.
syntax
```rst [command] [...]
.. rst instructions
(...)
```
RestructuredTextFormatter for now only knows one command: replace. This command works similar to the PHP-function str_replace and works on the contents of the block. The replace command takes 2 parameters: search-string, replace-string.
Example
```rst replace & @
.. code-block::
¶m ["Type"] $[name] [<description>]
```
The result:
@param ["Type"] $[name] [<description>]
In the above the tag-name @param can be in a code block of the PHPDoc, without being mangled by your IDE, that thinks you misplaced a tag.
Of course, you can always use rst directly in your PHPDocs:
.. hint:: text of special interest
Result:
Hint
text of special interest
Methods
RestructuredTextFormatter::handleLine
predicates |
public |
implements |
@inheritdoc
Handle a line of PHPDoc
As long as the formatter wants more lines it should return true. When it has enough it should return false.
@inheritdoc from method AbstractFormatter::handleLine
public function handleLine(
Parameter #0 [ <required> string $line ]
): bool
RestructuredTextFormatter::addLine
predicates |
protected |
inherited from |
Add a line to the resulting block
protected function addLine(
Parameter #0 [ <required> Stringable|string $line ]
): void
RestructuredTextFormatter::__toString
predicates |
public |
implements |
|
inherited from |
Returns a reStructuredText representation of the contents of the block
public function __toString(): string
RestructuredTextFormatter::getLineCount
predicates |
protected |
inherited from |
protected function getLineCount(): int
RestructuredTextFormatter::increaseLineCount
predicates |
protected |
inherited from |
protected function increaseLineCount(): int
Fri, 31 Mar 2023 13:22:46 +0000