Skip to content

Commit 2a5be8e

Browse files
committed
Fix escaping issues in tables
1 parent 9b09157 commit 2a5be8e

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

src/Example/Pizza.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use PhpDocumentorMarkdown\Example\Pizza\Base;
77

88
/**
9-
* A pizza | pie.
9+
* A pizza | pie's.
1010
*/
1111
class Pizza extends AbstractProduct implements ProductInterface, JsonSerializable
1212
{
@@ -42,7 +42,7 @@ class Pizza extends AbstractProduct implements ProductInterface, JsonSerializabl
4242
*
4343
* @param string $name Product name.
4444
* @param float $price Product price.
45-
* @param Base|null $base Pizza base.
45+
* @param Base|null $base Pizza's base.
4646
*/
4747
public function __construct(string $name = '', float $price = 10.0, ?Base $base = null)
4848
{

tests/Functional/expected/Home.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This is an automatically generated documentation for **Pizza Place (Example docu
1111
| Class | Description |
1212
|------------------------------------------------------------------------------|------------------------------|
1313
| [`AbstractProduct`](./classes/PhpDocumentorMarkdown/Example/AbstractProduct) | Base class for all products. |
14-
| [`Pizza`](./classes/PhpDocumentorMarkdown/Example/Pizza) | A pizza \| pie. |
14+
| [`Pizza`](./classes/PhpDocumentorMarkdown/Example/Pizza) | A pizza \| pie's. |
1515

1616
#### Traits
1717

tests/Functional/expected/classes/PhpDocumentorMarkdown/Example/Pizza.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Pizza
22

3-
A pizza \| pie.
3+
A pizza \| pie's.
44

55
***
66

@@ -67,7 +67,7 @@ Constructor description
6767
|-----------|-----------------------------------------------------|----------------|
6868
| `$name` | **string** | Product name. |
6969
| `$price` | **float** | Product price. |
70-
| `$base` | **\PhpDocumentorMarkdown\Example\Pizza\Base\|null** | Pizza base. |
70+
| `$base` | **\PhpDocumentorMarkdown\Example\Pizza\Base\|null** | Pizza's base. |
7171

7272
***
7373

themes/markdown/include/macros.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@
108108
# @param length int The target length of the string
109109
#}
110110
{% macro mdPadRight(str, length) %}
111-
{%- set str = str|default('') -%}
112-
{%- set delta = length - str|length -%}
113-
{{- str ~ _self.mdRepeat(' ', delta > 0 ? delta : 0) -}}
111+
{%- set str = str | default('') -%}
112+
{%- set delta = length - str | length -%}
113+
{{- (str ~ _self.mdRepeat(' ', delta > 0 ? delta : 0)) | raw -}}
114114
{% endmacro %}
115115

116116
{#
@@ -129,7 +129,7 @@
129129
{%- for row in rows %}
130130
{%- for col in headers %}
131131
{%- set value = attribute(row, col.key) %}
132-
{%- set value = _self.mdEsc(value) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw %}
132+
{%- set value = _self.mdEsc(value) %}
133133
{%- set length = value | length %}
134134
{%- if length > widths[loop.index0 ~ 'r'] %}
135135
{%- set widths = widths | merge({ (loop.index0 ~ 'r'): length }) %}
@@ -150,8 +150,8 @@
150150
{%- for row in rows %}
151151
{%- for col in headers %}
152152
{%- set value = attribute(row, col.key) %}
153-
{%- set value = _self.mdEsc(value) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw %}
154-
{{- '| ' ~ _self.mdPadRight(value, widths[loop.index0 ~ 'r']) ~ ' ' }}
153+
{%- set value = _self.mdEsc(value) %}
154+
{{- ('| ' ~ _self.mdPadRight(value, widths[loop.index0 ~ 'r']) ~ ' ') | raw }}
155155
{%- endfor -%}
156156
{{ '|' ~ "\n" }}
157157
{%- endfor %}

themes/markdown/index.md.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This is an automatically generated documentation for **{{project.name}}**.
1919
{% set parameters = parameters | merge([
2020
{
2121
link: macros.mdLink(class.FullyQualifiedStructuralElementName, null, null, 'class'),
22-
description: class.summary | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw
22+
description: class.summary | raw
2323
}
2424
]) %}
2525
{% endfor -%}
@@ -37,7 +37,7 @@ This is an automatically generated documentation for **{{project.name}}**.
3737
{% set parameters = parameters | merge([
3838
{
3939
link: macros.mdLink(trait.FullyQualifiedStructuralElementName, null, null, 'class'),
40-
description: trait.summary | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw
40+
description: trait.summary | raw
4141
}
4242
]) %}
4343
{% endfor -%}
@@ -55,7 +55,7 @@ This is an automatically generated documentation for **{{project.name}}**.
5555
{% set parameters = parameters | merge([
5656
{
5757
link: macros.mdLink(interface.FullyQualifiedStructuralElementName, null, null, 'class'),
58-
description: interface.summary | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw
58+
description: interface.summary | raw
5959
}
6060
]) %}
6161
{% endfor -%}
@@ -73,7 +73,7 @@ This is an automatically generated documentation for **{{project.name}}**.
7373
{% set parameters = parameters | merge([
7474
{
7575
link: macros.mdLink(function.name, null, function.name ~ '()', 'function'),
76-
description: function.summary | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw
76+
description: function.summary | raw
7777
}
7878
]) %}
7979
{% endfor -%}

themes/markdown/method.md.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{
3535
name: '`$' ~ argument.name ~ '`',
3636
type: argument.type ? '**' ~ argument.type ~ '**' : '',
37-
description: argument.description | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw
37+
description: argument.description | raw
3838
}
3939
]) %}
4040
{% endfor -%}

0 commit comments

Comments
 (0)