Skip to content

Commit

Permalink
feat: Add .table-responsive CSS class for reference tables (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Levdbas authored Sep 13, 2024
1 parent fb351d2 commit 8e04e6e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions lib/Compiler/Method/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function compile()
return ($a->getName() < $b->getName()) ? -1 : 1;
});

$contents = '<div class="table-methods">';
$contents = '<div class="table-methods table-responsive">';
$contents .= self::PARAGRAPH;

$contents .= '| Name | Return Type | Summary/Returns |' . self::NEWLINE;
Expand Down Expand Up @@ -84,7 +84,7 @@ public function compileMethod($method)

$return = sprintf(
'| <span class="method-name">[%1$s](#%2$s)</span> | '
. '<span class="method-type">%3$s</span> | ',
. '<span class="method-type">%3$s</span> | ',
$name,
$this->sanitizeAnchor($method->getName()),
$this->sanitizeTypeList($method->getReturnType())
Expand All @@ -93,13 +93,13 @@ public function compileMethod($method)
$return .= '<span class="method-description">';

if (!empty($method->getSummary())) {
$return .= $this->sanitizeTextForTable($method->getSummary());
$return .= $this->sanitizeTextForTable($method->getSummary());
}

if (!empty($method->getReturnDescription())) {
$return .= '<br><br><span class="method-return"><span class="method-return-label">Returns:</span> '
. $this->sanitizeTextForTable($method->getReturnDescription())
. '</span>';
$return .= '<br><br><span class="method-return"><span class="method-return-label">Returns:</span> '
. $this->sanitizeTextForTable($method->getReturnDescription())
. '</span>';
}

$return .= '</span> |';
Expand Down
3 changes: 2 additions & 1 deletion lib/Compiler/Param/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function compile()
if (!is_array($this->params) || empty($this->params)) {
return $contents;
}

$contents = '<div class="table-responsive">';
$contents .= '| Name | Type | Description |' . self::NEWLINE;
$contents .= '| --- | --- | --- |' . self::NEWLINE;

Expand Down Expand Up @@ -70,6 +70,7 @@ public function compile()
}

$contents .= self::NEWLINE;
$contents .= '</div>';

return $contents;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Compiler/Property/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function compile()
return $contents;
}

$contents .= '<div class="table-properties">';
$contents .= '<div class="table-properties table-responsive">';
$contents .= self::PARAGRAPH;

$contents .= '| Name | Type | Description |' . self::NEWLINE;
Expand All @@ -52,8 +52,8 @@ public function compile()
foreach ($this->properties as $param) {
$contents .= sprintf(
'| <span class="property-name">$%1$s</span> | '
. '<span class="property-type">%2$s</span> | '
. '<span class="property-description">%3$s</span> |' . self::NEWLINE,
. '<span class="property-type">%2$s</span> | '
. '<span class="property-description">%3$s</span> |' . self::NEWLINE,
$param->getName(),
$this->sanitizeTypeList($param->getDocBlockType()),
$this->sanitizeTextForTable($param->getDescription())
Expand Down

0 comments on commit 8e04e6e

Please sign in to comment.