Skip to content

Commit

Permalink
Cleaned up API templates
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Nov 2, 2019
1 parent 5683126 commit 1997e9f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 49 deletions.
6 changes: 1 addition & 5 deletions templates/Api/themes/api-base/theme.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{

"javascript" : [

"api_definition.js",
"static/jquery.min.js",
"static/zephir-doc.js"

]

}
}
62 changes: 35 additions & 27 deletions templates/Api/themes/zephir/partials/class/content.phtml
Original file line number Diff line number Diff line change
@@ -1,55 +1,63 @@
<?php

$items = array(
array("name" => "Classes" , "url" => "/classes.html" ),
$items[] = array("name" => $fullName)
);
/**
* @var string $fullName
* @var string $className
* @var array $methods
* @var string[] $namespacePieces
* @var Zephir\ClassDefinition $classDefinition
* @var Zephir\CompilerFile $compilerFile
*/

$items = [
['name' => 'Classes' , 'url' => '/classes.html'],
$items[] = ['name' => $fullName]
];
?>

<?= $this->partial("partials/breadcrumb.phtml",array("items"=> $items)) ?>
<?= $this->partial('partials/breadcrumb.phtml', ['items'=> $items]) ?>

<div class="class-header clearfix">



<div class="access-buttons">
<a class="zep-button" href="<?= $this->url(Zephir\Documentation::sourceUrl($classDefinition)) ?>">Source</a>

<?php if($this->themeOption("github")){ ?>
<a class="zep-button" href="<?= $this->themeOption("github") . "/tree/master/" . $compilerFile->getFilePath() ?>">Github</a>
<?php if ($this->themeOption('github')) { ?>
<a class="zep-button"
href="<?= rtrim($this->themeOption('github'), '/') . "/tree/master/{$compilerFile->getFilePath()}" ?>">
GitHub
</a>
<?php } ?>
</div>

<div class="class-full-name">

<span class="class-type">Class</span>

<?php foreach($namespacePieces as $nsname => $nspath){ ?>
<?php foreach ($namespacePieces as $nsname => $nspath) { ?>
<span class="namespace-piece">
<a href="<?= $this->url(Zephir\Documentation::namespaceUrl($nspath)) ?>"><?=$nsname?></a>
<a href="<?= $this->url(Zephir\Documentation::namespaceUrl($nspath)) ?>">
<?=$nsname?>
</a>
</span>
<?php } ?>

<h1 class="class-name"><?= $className ?></h1>
</div>

</div>


<div class="hidden-anchor" id="methods"></div>
<div class="methods-summary standard-bandeau">Methods</div>
<ul class="method-summary-list">
<?php foreach($methods as $method){ ?>

<?= $this->partial("partials/class/method-summary.phtml",array("method"=>$method)) ?>

<?php } ?>
<ul class="method-summary-list">
<?php foreach ($methods as $method): ?>
<?= $this->partial('partials/class/method-summary.phtml', ['method' => $method]) ?>
<?php endforeach; ?>
</ul>

<div class="hidden-anchor" id="methods-details"></div>
<div class="hidden-anchor" id="methods-details"></div>
<div class="methods-summary standard-bandeau">Methods Details</div>
<ul class="method-details-list">
<?php foreach($methods as $method){ ?>

<?= $this->partial("partials/class/method-details.phtml",array("method"=>$method)) ?>

<?php } ?>
</ul>
<ul class="method-details-list">
<?php foreach ($methods as $method): ?>
<?= $this->partial('partials/class/method-details.phtml', ['method' => $method]) ?>
<?php endforeach; ?>
</ul>
23 changes: 15 additions & 8 deletions templates/Api/themes/zephir/partials/class/method-details.phtml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
<?php
/* @var $method \Zephir\ClassMethod */

$visibilities = $method->getVisibility();
$docblock = $method->getParsedDocBlock();
/**
* @var Zephir\ClassMethod $method
*/
?>

<li class="class-method clearfix">
<div class="hidden-anchor" id="method-details-<?= $method->getName() ?>"></div>
<div class="method-details">
<div class="method-details-details">
<div class="method-signature">
<?php foreach($visibilities as $visibility): ?>

<p class="method-signature">
<?php foreach ($method->getVisibility() as $visibility): ?>
<span class="visibility-<?= $visibility ?> keyword"><?= $visibility ?></span>
<?php endforeach; ?>
<span class="keyword">function</span>&nbsp;<span class="method-name"><?= $method->getName() ?></span>(<?= $this->partial("partials/class/method-summary-params.phtml" ) ?>)
</div>
<span class="keyword">function</span>
<!-- method-details -->
<!-- Do not remove comments below. It's a trick to remove the spaces. -->
<span class="method-name"><?= $method->getName() ?></span><!--
-->(<?= $this->partial('partials/class/method-summary-params.phtml') ?>)
</p>

<div class="method-doc">
<?php $docblock = $method->getParsedDocBlock(); ?>
<?php if ($docblock): ?>
<div class="summary">
<?= $docblock->getSummary() ?>
Expand All @@ -25,6 +31,7 @@ $docblock = $method->getParsedDocBlock();
</div>
<?php endif; ?>
</div>

</div>
</div>
</li>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @var $method \Zephir\ClassMethod
* @var $method Zephir\ClassMethod
*/

if ($method->getParameters()) {
Expand All @@ -16,5 +16,5 @@ if ($method->getParameters()) {
$i++;
}

echo trim(join(', ', $parameters));
echo trim(implode(', ', $parameters));
}
8 changes: 1 addition & 7 deletions templates/Api/themes/zephir/theme.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
{

"extends" : "api-base",

"javascript" : [

"static/prettify.js"

],

"css" : [

"static/prettify.css",
"static/zephir-theme.css"

]

}
}

0 comments on commit 1997e9f

Please sign in to comment.