Skip to content

Commit

Permalink
Merge pull request #8 from woocommerce/v2
Browse files Browse the repository at this point in the history
New template with source code and faster search engine
  • Loading branch information
claudiosanches authored Sep 24, 2020
2 parents dd6ebb9 + 7ae6e93 commit 0b37fb2
Show file tree
Hide file tree
Showing 99 changed files with 2,781 additions and 12,710 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"php": ">=7.2.5"
},
"require-dev": {
"phpdocumentor/phpdocumentor": "v3.0.0-rc"
"phpdocumentor/phpdocumentor": "dev-master"
}
}
222 changes: 110 additions & 112 deletions composer.lock

Large diffs are not rendered by default.

79 changes: 1 addition & 78 deletions data/templates/woocommerce/base.html.twig
Original file line number Diff line number Diff line change
@@ -1,78 +1 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WooCommerce Code Reference</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro">
<link rel="stylesheet" href="{{ path('css/normalize.css') }}">
<link rel="stylesheet" href="{{ path('css/template.css') }}">
<link rel="shortcut icon" href="{{ path('images/favicon.png') }}"/>
<link rel="apple-touch-icon" href="{{ path('images/apple-touch-icon.png') }}"/>
<link rel="apple-touch-icon" sizes="72x72" href="{{ path('images/apple-touch-icon-72x72.png') }}"/>
<link rel="apple-touch-icon" sizes="114x114" href="{{ path('images/apple-touch-icon-114x114.png') }}"/>
{% block stylesheets %}{% endblock %}
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.4.6/fuse.min.js"></script>
<script src="{{ path('js/search.js') }}"></script>
<script defer src="{{ path('js/searchIndex.js') }}"></script>
{% block javascripts %}{% endblock %}
</head>
<body>
<header class="phpdocumentor-top-header">
<section class="phpdocumentor-section">
<div class="site-branding">
<a class="site-logo" href="{{ path("/index.html") }}"><img width="180" src="{{ path('images/logo.svg') }}" alt="WooCommerce" /></a>
</div>
<nav class="main-navigation">
<ul>
<li><a href="{{ path('hooks/hooks.html') }}">Hooks Reference</a></li>
{% if project.settings.custom['graphs.enabled'] %}
<li><a href="{{ path('graphs/classes.html') }}">Class Diagram</a></li>
{% endif %}
<li><a href="https://docs.woocommerce.com/">Documentation</a></li>
<li><a href="https://woocommerce.github.io/woocommerce-rest-api-docs/">REST API Docs</a></li>
</ul>
</nav>
</section>
</header>
<header class="phpdocumentor-header">
<section class="phpdocumentor-section">
<h1 class="phpdocumentor-title">WooCommerce Code Reference</h1>
</section>

<section class="phpdocumentor-section">
<div data-search-form class="phpdocumentor-search">
<label class="phpdocumentor-label">
<span class="visually-hidden">Search</span>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading..." disabled />
</label>
</div>
<div data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">

<h2>Search results</h2>
<ul class="phpdocumentor-search-results__entries">

</ul>
</div>
</section>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
{% include 'sidebar.html.twig' %}

<div class="nine phpdocumentor-columns phpdocumentor-content">
{% block content %}{% endblock %}
</div>
</div>
</main>
<a href="#" class="to-top">Back to the top</a>
<footer class="phpdocumentor phpdocumentor-footer">
<div class="phpdocumentor-section">
<span>WooCommerce Code Reference API documentation generated by <a href="http://www.phpdoc.org/">phpDocumentor</a> on {{ "now"|date('F jS, Y \\a\\t h:i a') }}.</span>
</div>
</footer>
</body>
</html>
{% extends 'layout.html.twig' %}
12 changes: 0 additions & 12 deletions data/templates/woocommerce/breadcrumbs.html.twig

This file was deleted.

146 changes: 8 additions & 138 deletions data/templates/woocommerce/class.html.twig
Original file line number Diff line number Diff line change
@@ -1,145 +1,15 @@
{% extends 'base.html.twig' %}

{% block content %}
{% include 'breadcrumbs.html.twig' %}
{% include 'components/breadcrumbs.html.twig' %}

<article class="phpdocumentor-element phpdocumentor-class">
<h2 class="phpdocumentor-content__title">
{{ node.name }}
{% if node.parent %}
<span class="phpdocumentor-class__extends">
extends {{ node.parent|route('class:short') }}
</span>
{% endif %}
{% if usesPackages %}
<div class="phpdocumentor-element__package">
in
<ul class="phpdocumentor-breadcrumbs">
{% for breadcrumb in packages(node) %}
<li><a href="{{ link(breadcrumb) }}">{{ breadcrumb.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if node.interfaces is not empty %}
<span class="phpdocumentor-class__implements">
implements
{% for interface in node.interfaces %}
{{ interface|route('class:short') }}{% if not loop.last %}, {% endif %}
{% endfor %}
</span>
{% endif %}
{% if node.usedTraits is not empty %}
<span class="phpdocumentor-class__extends">
Uses
{% for trait in node.usedTraits %}
{{ trait|route('class:short') }}{% if not loop.last %}, {% endif %}
{% endfor %}
</span>
{% endif %}
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="{{ node.file.path }}">{{ node.file|route('file:short') }}</abbr>
:
<span class="phpdocumentor-element-found-in__line">{{ node.line }}</span>
</aside>
<article class="phpdocumentor-element -class">
{{ include('components/class-title.html.twig') }}
{{ include('components/element-found-in.html.twig') }}
{{ include('components/element-header.html.twig') }}

<p class="phpdocumentor-class__summary">{{ node.summary }}</p>
<section class="phpdocumentor-class__description">{{ node.description|markdown }}</section>

<h3>Table of Contents</h3>
<table class="phpdocumentor-table_of_contents">
{% for constant in node.constants %}
<tr>
<th class="phpdocumentor-heading"><a href="{{ link(constant) }}">{{ constant.name }}</a></th>
<td class="phpdocumentor-cell">{{ constant.summary }}</td>
<td class="phpdocumentor-cell">{{ constant.value }}</td>
</tr>
{% endfor %}
{% for property in node.properties %}
<tr>
<th class="phpdocumentor-heading"><a href="{{ link(property) }}">${{ property.name }}</a></th>
<td class="phpdocumentor-cell">{{ property.summary }}</td>
<td class="phpdocumentor-cell">{{ property.type|route('class:short')|join('|')|raw }}</td>
</tr>
{% endfor %}
{% for property in node.magicProperties %}
<tr>
<th class="phpdocumentor-heading"><a href="{{ link(property) }}">${{ property.name }}</a></th>
<td class="phpdocumentor-cell">{{ property.summary }}</td>
<td class="phpdocumentor-cell">{{ property.type|route('class:short')|join('|')|raw }}</td>
</tr>
{% endfor %}
{% for property in node.inheritedProperties %}
<tr>
<th class="phpdocumentor-heading"><a href="{{ link(property) }}">${{ property.name }}</a></th>
<td class="phpdocumentor-cell">{{ property.summary }}</td>
<td class="phpdocumentor-cell">{{ property.type|route('class:short')|join('|')|raw }}</td>
</tr>
{% endfor %}
{% for method in node.methods %}
<tr>
<th class="phpdocumentor-heading"><a href="{{ link(method) }}">{{ method.name }}()</a></th>
<td class="phpdocumentor-cell">{{ method.summary }}</td>
<td class="phpdocumentor-cell">{{ method.response.type|route('class:short')|join('|')|raw }}</td>
</tr>
{% endfor %}
{% for method in node.magicMethods %}
<tr>
<th class="phpdocumentor-heading"><a href="{{ link(method) }}">{{ method.name }}()</a></th>
<td class="phpdocumentor-cell">{{ method.summary }}</td>
<td class="phpdocumentor-cell">{{ method.response.type|route('class:short')|join('|')|raw }}</td>
</tr>
{% endfor %}
{% for method in node.inheritedMethods %}
<tr>
<th class="phpdocumentor-heading"><a href="{{ link(method) }}">{{ method.name }}()</a></th>
<td class="phpdocumentor-cell">{{ method.summary }}</td>
<td class="phpdocumentor-cell">{{ method.response.type|route('class:short')|join('|')|raw }}</td>
</tr>
{% endfor %}
</table>

{% if node.constants is not empty %}
<section>
<h3 class="phpdocumentor-constants__header">Constants</h3>
{% for constant in node.constants %}
{% include 'constant.html.twig' %}
{% endfor %}
{% for constant in node.inheritedConstants %}
{% include 'constant.html.twig' %}
{% endfor %}
</section>
{% endif %}

{% if node.properties is not empty or node.magicProperties is not empty or node.inheritedProperties is not empty %}
<section>
<h3 class="phpdocumentor-properties__header">Properties</h3>
{% for property in node.properties %}
{% include 'property.html.twig' %}
{% endfor %}
{% for property in node.magicProperties %}
{% include 'property.html.twig' %}
{% endfor %}
{% for property in node.inheritedProperties %}
{% include 'property.html.twig' %}
{% endfor %}
</section>
{% endif %}

{% if node.methods is not empty or node.magicMethods is not empty or node.inheritedMethods is not empty %}
<section>
<h3 class="phpdocumentor-methods__header">Methods</h3>
{% for method in node.methods %}
{% include 'method.html.twig' %}
{% endfor %}
{% for method in node.magicMethods %}
{% include 'method.html.twig' %}
{% endfor %}
{% for method in node.inheritedMethods %}
{% include 'method.html.twig' %}
{% endfor %}
</section>
{% endif %}
{{ include('components/constants.html.twig') }}
{{ include('components/properties.html.twig') }}
{{ include('components/methods.html.twig') }}
</article>
{% endblock %}
9 changes: 9 additions & 0 deletions data/templates/woocommerce/components/admonition.css.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.phpdocumentor-admonition {
border: 1px solid var(--admonition-border-color);
border-radius: var(--border-radius-base-size);
padding: var(--spacing-sm) var(--spacing-md);
}

.phpdocumentor-admonition--success {
border-color: var(--admonition-success-color);
}
13 changes: 13 additions & 0 deletions data/templates/woocommerce/components/back-to-top.css.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.phpdocumentor .phpdocumentor-back-to-top {
position: fixed;
bottom: 2rem;
font-size: 2.5rem;
opacity: .25;
transition: all .3s ease-in-out;
right: 2rem;
}

.phpdocumentor .phpdocumentor-back-to-top:hover {
color: var(--link-color-primary);
opacity: 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
22 changes: 22 additions & 0 deletions data/templates/woocommerce/components/breadcrumbs.css.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.phpdocumentor ul.phpdocumentor-breadcrumbs {
font-size: var(--text-md);
list-style: none;
margin: 0;
padding: 0;
}

.phpdocumentor ul.phpdocumentor-breadcrumbs a {
color: var(--text-color);
text-decoration: none;
}

.phpdocumentor ul.phpdocumentor-breadcrumbs > li {
display: inline-block;
margin: 0;
}

.phpdocumentor ul.phpdocumentor-breadcrumbs > li + li:before {
color: var(--dark-gray);
content: "\\\A0";
padding: 0;
}
6 changes: 6 additions & 0 deletions data/templates/woocommerce/components/breadcrumbs.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% set breadcrumbs = usesNamespaces ? breadcrumbs(node) : packages(node) %}
<ul class="phpdocumentor-breadcrumbs">
{% for breadcrumb in breadcrumbs %}
<li class="phpdocumentor-breadcrumb"><a href="{{ link(breadcrumb) }}">{{ breadcrumb.name }}</a></li>
{% endfor %}
</ul>
7 changes: 7 additions & 0 deletions data/templates/woocommerce/components/class-graph.css.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.phpdocumentor-class-graph {
width: 100%; height: 600px; border:1px solid black; overflow: hidden
}

.phpdocumentor-class-graph__graph {
width: 100%;
}
38 changes: 38 additions & 0 deletions data/templates/woocommerce/components/class-title.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<h2 class="phpdocumentor-content__title">
{{ node.name }}

{% if node.parent %}
<span class="phpdocumentor-element__extends">
extends {{ node.parent|route('class:short') }}
</span>
{% endif %}

{% if usesPackages %}
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
{% for breadcrumb in packages(node) %}
<li class="phpdocumentor-breadcrumb"><a href="{{ link(breadcrumb) }}">{{ breadcrumb.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}

{% if node.interfaces is not empty %}
<span class="phpdocumentor-element__implements">
implements
{% for interface in node.interfaces %}
{{ interface|route('class:short') }}{% if not loop.last %}, {% endif %}
{% endfor %}
</span>
{% endif %}

{% if node.usedTraits is not empty %}
<span class="phpdocumentor-element__extends">
Uses
{% for trait in node.usedTraits %}
{{ trait|route('class:short') }}{% if not loop.last %}, {% endif %}
{% endfor %}
</span>
{% endif %}
</h2>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<code class="phpdocumentor-signature phpdocumentor-code {% if node.deprecated %}-deprecated{% endif %}">
<span class="phpdocumentor-signature__visibility">{{ node.visibility }}</span>
<span class="phpdocumentor-signature__type">{{ not node.type ? "mixed" : node.type|route('class:short')|join('|')|raw }}</span>
<span class="phpdocumentor-signature__name">{{ node.name }}</span>
= <span class="phpdocumentor-signature__default-value">{{ node.value ?: '""' }}</span>
</code>
13 changes: 13 additions & 0 deletions data/templates/woocommerce/components/constant.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<article class="phpdocumentor-element -constant -{{ constant.visibility }} {% if constant.deprecated %}-deprecated{% endif %}">
<h4 class="phpdocumentor-element__name" id="constant_{{ constant.name }}">
{{ constant.name }}
<a href="#constant_{{ constant.name }}" class="headerlink"><i class="fas fa-link"></i></a>
</h4>

{{ include('components/element-found-in.html.twig', {'node': constant}) }}
{{ include('components/summary.html.twig', {'node': constant}) }}
{{ include('components/constant-signature.html.twig', {'node': constant}) }}

{{ include('components/description.html.twig', {'node': constant}) }}
{{ include ('components/tags.html.twig', {tags: constant.tags}) }}
</article>
13 changes: 13 additions & 0 deletions data/templates/woocommerce/components/constants.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% set constants = constants(node)|sortByVisibility %}

{% if constants is not empty %}
<section class="phpdocumentor-constants">
<h3 class="phpdocumentor-elements__header" id="constants">
Constants
<a href="#constants" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
{% for constant in constants %}
{% include 'components/constant.html.twig' %}
{% endfor %}
</section>
{% endif %}
3 changes: 3 additions & 0 deletions data/templates/woocommerce/components/description.css.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.phpdocumentor-description {
margin-bottom: var(--spacing-md);
}
Loading

0 comments on commit 0b37fb2

Please sign in to comment.