diff --git a/.gitignore b/.gitignore index 76fcb9ac..57e5dcd0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ build composer.lock vendor -doc/_site -doc/_data/versions.yml +doc/public +doc/data/versions.json .generated +.phpunit.result.cache diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9eebab6e..c2cc4f69 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,4 +19,11 @@ We accept contributions via Pull Requests on [Github](https://github.com/thephpl ``` bash $ phpunit ``` + +## Docs + +Docs are served with hugo running on version 0.79 or later. + +You can view the docs locally with `hugo -s doc server` + **Happy coding**! \ No newline at end of file diff --git a/README.md b/README.md index 02bd80ab..d92f7eee 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Please see [CONTRIBUTING](https://github.com/thephpleague/plates/blob/master/CON ## Security -If you discover any security related issues, please email rj@bighead.net instead of using the issue tracker. +If you discover any security related issues, please email ragboyjr@icloud.com instead of using the issue tracker. ## Credits diff --git a/composer.json b/composer.json index 4abb669c..b9667139 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, { "name": "RJ Garcia", - "email": "rj@bighead.net", + "email": "ragboyjr@icloud.com", "role": "Developer" } ], @@ -46,6 +46,7 @@ } }, "scripts": { - "test": "phpunit" + "test": "phpunit --testdox", + "docs": "hugo -s doc server" } } diff --git a/doc/Gemfile b/doc/Gemfile deleted file mode 100644 index 91ceacd3..00000000 --- a/doc/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -source 'https://rubygems.org' -gem 'github-pages', group: :jekyll_plugins \ No newline at end of file diff --git a/doc/Gemfile.lock b/doc/Gemfile.lock deleted file mode 100644 index cd613ad7..00000000 --- a/doc/Gemfile.lock +++ /dev/null @@ -1,238 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - activesupport (4.2.9) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.11.1) - colorator (1.1.0) - commonmarker (0.17.7.1) - ruby-enum (~> 0.5) - concurrent-ruby (1.0.5) - ethon (0.11.0) - ffi (>= 1.3.0) - execjs (2.7.0) - faraday (0.13.1) - multipart-post (>= 1.2, < 3) - ffi (1.9.18) - forwardable-extended (2.6.0) - gemoji (3.0.0) - github-pages (172) - activesupport (= 4.2.9) - github-pages-health-check (= 1.3.5) - jekyll (= 3.6.2) - jekyll-avatar (= 0.5.0) - jekyll-coffeescript (= 1.0.2) - jekyll-commonmark-ghpages (= 0.1.3) - jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.9.2) - jekyll-gist (= 1.4.1) - jekyll-github-metadata (= 2.9.3) - jekyll-mentions (= 1.2.0) - jekyll-optional-front-matter (= 0.3.0) - jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.2.0) - jekyll-redirect-from (= 0.12.1) - jekyll-relative-links (= 0.5.2) - jekyll-remote-theme (= 0.2.3) - jekyll-sass-converter (= 1.5.0) - jekyll-seo-tag (= 2.3.0) - jekyll-sitemap (= 1.1.1) - jekyll-swiss (= 0.4.0) - jekyll-theme-architect (= 0.1.0) - jekyll-theme-cayman (= 0.1.0) - jekyll-theme-dinky (= 0.1.0) - jekyll-theme-hacker (= 0.1.0) - jekyll-theme-leap-day (= 0.1.0) - jekyll-theme-merlot (= 0.1.0) - jekyll-theme-midnight (= 0.1.0) - jekyll-theme-minimal (= 0.1.0) - jekyll-theme-modernist (= 0.1.0) - jekyll-theme-primer (= 0.5.2) - jekyll-theme-slate (= 0.1.0) - jekyll-theme-tactile (= 0.1.0) - jekyll-theme-time-machine (= 0.1.0) - jekyll-titles-from-headings (= 0.5.0) - jemoji (= 0.8.1) - kramdown (= 1.14.0) - liquid (= 4.0.0) - listen (= 3.0.6) - mercenary (~> 0.3) - minima (= 2.1.1) - rouge (= 2.2.1) - terminal-table (~> 1.4) - github-pages-health-check (1.3.5) - addressable (~> 2.3) - net-dns (~> 0.8) - octokit (~> 4.0) - public_suffix (~> 2.0) - typhoeus (~> 0.7) - html-pipeline (2.7.1) - activesupport (>= 2) - nokogiri (>= 1.4) - i18n (0.9.1) - concurrent-ruby (~> 1.0) - jekyll (3.6.2) - addressable (~> 2.4) - colorator (~> 1.0) - jekyll-sass-converter (~> 1.0) - jekyll-watch (~> 1.1) - kramdown (~> 1.14) - liquid (~> 4.0) - mercenary (~> 0.3.3) - pathutil (~> 0.9) - rouge (>= 1.7, < 3) - safe_yaml (~> 1.0) - jekyll-avatar (0.5.0) - jekyll (~> 3.0) - jekyll-coffeescript (1.0.2) - coffee-script (~> 2.2) - coffee-script-source (~> 1.11.1) - jekyll-commonmark (1.1.0) - commonmarker (~> 0.14) - jekyll (>= 3.0, < 4.0) - jekyll-commonmark-ghpages (0.1.3) - commonmarker (~> 0.17.6) - jekyll-commonmark (~> 1) - rouge (~> 2) - jekyll-default-layout (0.1.4) - jekyll (~> 3.0) - jekyll-feed (0.9.2) - jekyll (~> 3.3) - jekyll-gist (1.4.1) - octokit (~> 4.2) - jekyll-github-metadata (2.9.3) - jekyll (~> 3.1) - octokit (~> 4.0, != 4.4.0) - jekyll-mentions (1.2.0) - activesupport (~> 4.0) - html-pipeline (~> 2.3) - jekyll (~> 3.0) - jekyll-optional-front-matter (0.3.0) - jekyll (~> 3.0) - jekyll-paginate (1.1.0) - jekyll-readme-index (0.2.0) - jekyll (~> 3.0) - jekyll-redirect-from (0.12.1) - jekyll (~> 3.3) - jekyll-relative-links (0.5.2) - jekyll (~> 3.3) - jekyll-remote-theme (0.2.3) - jekyll (~> 3.5) - rubyzip (>= 1.2.1, < 3.0) - typhoeus (>= 0.7, < 2.0) - jekyll-sass-converter (1.5.0) - sass (~> 3.4) - jekyll-seo-tag (2.3.0) - jekyll (~> 3.3) - jekyll-sitemap (1.1.1) - jekyll (~> 3.3) - jekyll-swiss (0.4.0) - jekyll-theme-architect (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.5.2) - jekyll (~> 3.5) - jekyll-github-metadata (~> 2.9) - jekyll-seo-tag (~> 2.2) - jekyll-theme-slate (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.1.0) - jekyll (~> 3.5) - jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.0) - jekyll (~> 3.3) - jekyll-watch (1.5.1) - listen (~> 3.0) - jemoji (0.8.1) - activesupport (~> 4.0, >= 4.2.9) - gemoji (~> 3.0) - html-pipeline (~> 2.2) - jekyll (>= 3.0) - kramdown (1.14.0) - liquid (4.0.0) - listen (3.0.6) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9.7) - mercenary (0.3.6) - mini_portile2 (2.3.0) - minima (2.1.1) - jekyll (~> 3.3) - minitest (5.11.1) - multipart-post (2.0.0) - net-dns (0.8.0) - nokogiri (1.8.1) - mini_portile2 (~> 2.3.0) - octokit (4.8.0) - sawyer (~> 0.8.0, >= 0.5.3) - pathutil (0.16.1) - forwardable-extended (~> 2.6) - public_suffix (2.0.5) - rb-fsevent (0.10.2) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - rouge (2.2.1) - ruby-enum (0.7.1) - i18n - rubyzip (1.2.1) - safe_yaml (1.0.4) - sass (3.5.5) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - thread_safe (0.3.6) - typhoeus (0.8.0) - ethon (>= 0.8.0) - tzinfo (1.2.4) - thread_safe (~> 0.1) - unicode-display_width (1.3.0) - -PLATFORMS - ruby - -DEPENDENCIES - github-pages - -BUNDLED WITH - 1.16.1 \ No newline at end of file diff --git a/doc/_data/images.yml b/doc/_data/images.yml deleted file mode 100644 index 56d11839..00000000 --- a/doc/_data/images.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Path to project specific favicon.ico, leave blank to use default -favicon: /favicon.ico - -# Path to project specific apple-touch-icon-precomposed.png, leave blank to use default -apple_touch: /apple-touch-icon-precomposed.png - -# Path to project logo -logo: /logo.png \ No newline at end of file diff --git a/doc/_data/menu.yml b/doc/_data/menu.yml deleted file mode 100644 index 2cab5185..00000000 --- a/doc/_data/menu.yml +++ /dev/null @@ -1,25 +0,0 @@ -Getting Started: - Introduction: '/' - Simple example: '/simple-example/' - Installation: '/installation/' - Changelog: '/changelog/' -The Engine: - Overview: '/engine/' - File extensions: '/engine/file-extensions/' - Folders: '/engine/folders/' - Functions: '/engine/functions/' - Extensions: '/engine/extensions/' -Templates: - Overview: '/templates/' - Data: '/templates/data/' - Functions: '/templates/functions/' - Nesting: '/templates/nesting/' - Layouts: '/templates/layouts/' - Sections: '/templates/sections/' - Inheritance: '/templates/inheritance/' - Escaping: '/templates/escaping/' - Syntax: '/templates/syntax/' -Extensions: - Asset: '/extensions/asset/' - URI: '/extensions/uri/' - Community: '/extensions/community/' diff --git a/doc/_data/project.yml b/doc/_data/project.yml deleted file mode 100644 index 4ff76f30..00000000 --- a/doc/_data/project.yml +++ /dev/null @@ -1,4 +0,0 @@ -title: Plates -tagline: Native PHP Templates -description: 'Plates is a Twig inspired, native PHP template system that brings modern template language functionality to native PHP templates.' -google_analytics_tracking_id: UA-46050814-2 \ No newline at end of file diff --git a/doc/_layouts/default.html b/doc/_layouts/default.html deleted file mode 100644 index 5cc34276..00000000 --- a/doc/_layouts/default.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - {% if page.url == '/' %} - {{ site.data.project.title }} - {{ site.data.project.tagline }} - {% else %} - {{ page.title }} - {{ site.data.project.title }} - {% endif %} - {% if site.data.project.description %} - - {% endif %} - {% if site.github.url %} - - {% endif %} - {% if site.data.images.favicon %} - - {% else %} - - {% endif %} - {% if site.data.images.apple_touch %} - - {% else %} - - {% endif %} - - - - - - - Fork me on GitHub - - -
- - The League of Extraordinary Packages - -

Our Packages:

- -
- -
- - - Presented by The League of Extraordinary Packages - -
- - - - -
- - {% for section in site.data.menu %} -

{{ section[0] }}

- - {% endfor %} -
-
- {{ content }} -
-
- - - - - - - -{% if site.data.project.google_analytics_tracking_id %} - -{% endif %} - - - diff --git a/doc/changelog.md b/doc/changelog.md deleted file mode 100644 index a471991d..00000000 --- a/doc/changelog.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -layout: default -permalink: changelog/ -title: Changelog ---- - -Changelog -========= - -All notable changes to this project will be documented in this file. - -{% for release in site.github.releases %} -## [{{ release.name }}]({{ release.html_url }}) - {{ release.published_at | date: "%Y-%m-%d" }} -{{ release.body | markdownify }} -{% endfor %} \ No newline at end of file diff --git a/doc/config.toml b/doc/config.toml new file mode 100644 index 00000000..8b7c1074 --- /dev/null +++ b/doc/config.toml @@ -0,0 +1,15 @@ +baseURL = "https://platesphp.com/" +languageCode = "en-us" +title = "Plates" + +pygmentsUseClasses = true + +googleAnalytics = "UA-46050814-2" + +[params] + tagline = "Native PHP Templates" + description = "Plates is a Twig inspired, native PHP template system that brings modern template language functionality to native PHP templates." + [params.images] + favicon = "favicon/favicon.ico" + appleTouch = "favicon/apple-touch-icon-precomposed.png" + logo = "images/logo.png" \ No newline at end of file diff --git a/doc/index.md b/doc/content/_index.md similarity index 69% rename from doc/index.md rename to doc/content/_index.md index 54e7aab5..54a5d65f 100644 --- a/doc/index.md +++ b/doc/content/_index.md @@ -1,11 +1,9 @@ ---- -layout: default -permalink: / -title: Introduction ---- - -Introduction -============ ++++ +title = "Introduction" +[menu.main] +parent = "getting-started" +weight = 1 ++++ [![Maintainer](http://img.shields.io/badge/maintainer-@ragboyjr-blue.svg?style=flat-square)](https://twitter.com/reinink) [![Source Code](http://img.shields.io/badge/source-league/plates-blue.svg?style=flat-square)](https://github.com/thephpleague/plates) @@ -22,15 +20,15 @@ Plates is a native PHP template system that's fast, easy to use and easy to exte ## Highlights -- Native PHP templates, no new [syntax]({{ site.baseurl }}{% link templates/syntax.md %}) to learn +- Native PHP templates, no new [syntax]({{< relref "templates/syntax.md" >}}) to learn - Plates is a template system, not a template language - Plates encourages the use of existing PHP functions -- Increase code reuse with template [layouts]({{ site.baseurl }}{% link templates/layouts.md %}) and [inheritance]({{ site.baseurl }}{% link templates/inheritance.md %}) -- Template [folders]({{ site.baseurl }}{% link engine/folders.md %}) for grouping templates into namespaces -- [Data]({{ site.baseurl }}/templates/data.md#preassigned-and-shared-data) sharing across templates -- Preassign [data]({{ site.baseurl }}/templates/data#preassigned-and-shared-data) to specific templates -- Built-in [escaping]({{ site.baseurl }}{% link templates/escaping.md %}) helpers -- Easy to extend using [functions]({{ site.baseurl }}{% link engine/functions.md %}) and [extensions]({{ site.baseurl }}{% link engine/extensions.md %}) +- Increase code reuse with template [layouts]({{< relref "templates/layouts.md" >}}) and [inheritance]({{< relref "templates/inheritance.md" >}}) +- Template [folders]({{< relref "engine/folders.md" >}}) for grouping templates into namespaces +- [Data]({{< relref "templates/data.md#preassigned-and-shared-data" >}}) sharing across templates +- Preassign [data]({{< relref "templates/data#preassigned-and-shared-data" >}}) to specific templates +- Built-in [escaping]({{< relref "templates/escaping.md" >}}) helpers +- Easy to extend using [functions]({{< relref "engine/functions.md" >}}) and [extensions]({{< relref "engine/extensions.md" >}}) - Framework-agnostic, will work with any project - Decoupled design makes templates easy to test - Composer ready and PSR-2 compliant diff --git a/doc/content/engine/_index.md b/doc/content/engine/_index.md new file mode 100644 index 00000000..a6f8de99 --- /dev/null +++ b/doc/content/engine/_index.md @@ -0,0 +1,6 @@ ++++ +title = "The Engine" +[menu.main] +identifier = "engine" +weight = 2 ++++ \ No newline at end of file diff --git a/doc/engine/extensions.md b/doc/content/engine/extensions.md similarity index 85% rename from doc/engine/extensions.md rename to doc/content/engine/extensions.md index 84453474..7d206713 100644 --- a/doc/engine/extensions.md +++ b/doc/content/engine/extensions.md @@ -1,13 +1,12 @@ ---- -layout: default -permalink: engine/extensions/ -title: Extensions ---- ++++ +title = "Extensions" +linkTitle = "Engine Extensions" +[menu.main] +parent = "engine" +weight = 5 ++++ -Extensions -========== - -Creating extensions couldn't be easier, and can really make Plates sing for your specific project. Start by creating a class that implements `\League\Plates\Extension\ExtensionInterface`. Next, register your template [functions]({{ site.baseurl }}{% link engine/functions.md %}) within a `register()` method. +Creating extensions couldn't be easier, and can really make Plates sing for your specific project. Start by creating a class that implements `\League\Plates\Extension\ExtensionInterface`. Next, register your template [functions]({{< relref "engine/functions.md" >}}) within a `register()` method. ## Simple extensions example @@ -41,7 +40,7 @@ To use this extension in your template, simply call your new functions:

Hello, e($this->uppercase($name))?>

~~~ -They can also be used in a [batch]({{ site.baseurl }}/templates/functions/#batch-function-calls) compatible function: +They can also be used in a [batch]({{< relref "templates/functions.md#batch-function-calls" >}}) compatible function: ~~~ php

Hello e($name, 'uppercase')

@@ -87,7 +86,7 @@ To use this extension in your template, first call the primary function, then th ## Loading extensions -To enable an extension, load it into the [engine]({{ site.baseurl }}{% link engine/index.md %}) object using the `loadExtension()` method. +To enable an extension, load it into the [engine]({{< relref "engine/overview.md" >}}) object using the `loadExtension()` method. ~~~ php $engine->loadExtension(new ChangeCase()); diff --git a/doc/engine/file-extensions.md b/doc/content/engine/file-extensions.md similarity index 87% rename from doc/engine/file-extensions.md rename to doc/content/engine/file-extensions.md index 613bccf4..e58023b4 100644 --- a/doc/engine/file-extensions.md +++ b/doc/content/engine/file-extensions.md @@ -1,11 +1,10 @@ ---- -layout: default -permalink: engine/file-extensions/ -title: File extensions ---- - -File extensions -=============== ++++ +title = "File Extensions" +linkTitle = "Engine File Extensions" +[menu.main] +parent = "engine" +weight = 2 ++++ Plates does not enforce a specific template file extension. By default it assumes `.php`. This file extension is automatically appended to your template names when rendered. You are welcome to change the default extension using one of the following methods. diff --git a/doc/engine/folders.md b/doc/content/engine/folders.md similarity index 93% rename from doc/engine/folders.md rename to doc/content/engine/folders.md index 7991bfcd..c90bfb0b 100644 --- a/doc/engine/folders.md +++ b/doc/content/engine/folders.md @@ -1,11 +1,10 @@ ---- -layout: default -permalink: engine/folders/ -title: Folders ---- - -Folders -======= ++++ +title = "Folders" +linkTitle = "Engine Folders" +[menu.main] +parent = "engine" +weight = 3 ++++ Folders make it really easy to organize and access your templates. Folders allow you to group your templates under different namespaces, each of which having their own file system path. diff --git a/doc/engine/functions.md b/doc/content/engine/functions.md similarity index 50% rename from doc/engine/functions.md rename to doc/content/engine/functions.md index 87b95f89..cb9941be 100644 --- a/doc/engine/functions.md +++ b/doc/content/engine/functions.md @@ -1,13 +1,12 @@ ---- -layout: default -permalink: engine/functions/ -title: Functions ---- ++++ +title = "Functions" +linkTitle = "Engine Functions" +[menu.main] +parent = "engine" +weight = 4 ++++ -Functions -========= - -While [extensions]({{ site.baseurl }}{% link engine/extensions.md %}) are awesome for adding additional reusable functionality to Plates, sometimes it's easier to just create a one-off function for a specific use case. Plates makes this easy to do. +While [extensions]({{< relref "engine/extensions.md" >}}) are awesome for adding additional reusable functionality to Plates, sometimes it's easier to just create a one-off function for a specific use case. Plates makes this easy to do. ## Registering functions @@ -27,7 +26,7 @@ To use this function in a template, simply call it like any other function:

Hello e($this->uppercase($name))

~~~ -It can also be used in a [batch]({{ site.baseurl }}/templates/functions/#batch-function-calls) compatible function: +It can also be used in a [batch]({{< relref "templates/functions#batch-function-calls">}}) compatible function: ~~~ php

Hello e($name, 'uppercase')

diff --git a/doc/engine/index.md b/doc/content/engine/overview.md similarity index 92% rename from doc/engine/index.md rename to doc/content/engine/overview.md index fe0365be..b7db2ff3 100644 --- a/doc/engine/index.md +++ b/doc/content/engine/overview.md @@ -1,11 +1,11 @@ ---- -layout: default -permalink: engine/ -title: The Engine ---- - -The Engine -========== ++++ +title = "Overview" +linkTitle = "Engine Overview" +aliases = ["/engine"] +[menu.main] +parent = "engine" +weight = 1 ++++ Plates uses a central object called the `Engine`, which is used to store the environment configuration, functions and extensions. It helps decouple your templates from the file system and other dependencies. For example, if you want to change the folder where your templates are stored, you can do so by simply changing the path in one location. diff --git a/doc/content/extensions/_index.md b/doc/content/extensions/_index.md new file mode 100644 index 00000000..bfe10071 --- /dev/null +++ b/doc/content/extensions/_index.md @@ -0,0 +1,6 @@ ++++ +title = "Extensions" +[menu.main] +identifier = "extensions" +weight = 4 ++++ \ No newline at end of file diff --git a/doc/extensions/asset.md b/doc/content/extensions/asset.md similarity index 95% rename from doc/extensions/asset.md rename to doc/content/extensions/asset.md index 6a1d40e6..9d7d05f7 100644 --- a/doc/extensions/asset.md +++ b/doc/content/extensions/asset.md @@ -1,11 +1,9 @@ ---- -layout: default -permalink: extensions/asset/ -title: Asset extension ---- - -Asset -===== ++++ +title = "Asset" +[menu.main] +parent = "extensions" +weight = 1 ++++ The asset extension can be used to quickly create "cache busted" asset URLs in your templates. This is particularly helpful for aggressively cached files that can potentially change in the future, such as CSS files, JavaScript files and images. It works by appending the timestamp of the file's last update to its URL. For example, `/css/all.css` becomes `/css/all.1373577602.css`. As long as the file does not change, the timestamp remains the same and caching occurs. However, if the file is changed, a new URL is automatically generated with a new timestamp, and visitors receive the new file. diff --git a/doc/extensions/community.md b/doc/content/extensions/community.md similarity index 84% rename from doc/extensions/community.md rename to doc/content/extensions/community.md index 139dc09d..6282d3a4 100644 --- a/doc/extensions/community.md +++ b/doc/content/extensions/community.md @@ -1,10 +1,9 @@ ---- -layout: default -permalink: extensions/community/ -title: Community Extensions ---- - -# Community Extensions ++++ +title = "Community" +[menu.main] +parent = "extensions" +weight = 3 ++++ This is a list of all the known community extensions for the Plates library. Please feel free to submit a [Pull Request](https://github.com/thephpleague/plates) to add your extension to this list. diff --git a/doc/extensions/uri.md b/doc/content/extensions/uri.md similarity index 96% rename from doc/extensions/uri.md rename to doc/content/extensions/uri.md index e18c2060..1f3be1a2 100644 --- a/doc/extensions/uri.md +++ b/doc/content/extensions/uri.md @@ -1,11 +1,9 @@ ---- -layout: default -permalink: extensions/uri/ -title: URI extension ---- - -URI -=== ++++ +title = "URI" +[menu.main] +parent = "extensions" +weight = 2 ++++ The URI extension is designed to make URI checks within templates easier. The most common use is marking the current page in a menu as "selected". It only has one function, `uri()`, but can do a number of helpful tasks depending on the parameters passed to it. diff --git a/doc/content/getting-started/_index.md b/doc/content/getting-started/_index.md new file mode 100644 index 00000000..19d0b831 --- /dev/null +++ b/doc/content/getting-started/_index.md @@ -0,0 +1,6 @@ ++++ +title = "Getting Started" +[menu.main] +identifier = "getting-started" +weight = 1 ++++ \ No newline at end of file diff --git a/doc/installation.md b/doc/content/getting-started/installation.md similarity index 89% rename from doc/installation.md rename to doc/content/getting-started/installation.md index ba7a2b63..69a8401b 100644 --- a/doc/installation.md +++ b/doc/content/getting-started/installation.md @@ -1,11 +1,9 @@ ---- -layout: default -permalink: installation/ -title: Installation ---- - -Installation -============ ++++ +title = "Installation" +[menu.main] +parent = "getting-started" +weight = 3 ++++ ## Using Composer diff --git a/doc/simple-example.md b/doc/content/getting-started/simple-example.md similarity index 88% rename from doc/simple-example.md rename to doc/content/getting-started/simple-example.md index 35f9b71d..ad7a52bc 100644 --- a/doc/simple-example.md +++ b/doc/content/getting-started/simple-example.md @@ -1,11 +1,9 @@ ---- -layout: default -permalink: simple-example/ -title: Simple example ---- - -Simple example -============== ++++ +title = "Simple Example" +[menu.main] +parent = "getting-started" +weight = 2 ++++ Here is a simple example of how to use Plates. We will assume the following directory stucture: diff --git a/doc/content/templates/_index.md b/doc/content/templates/_index.md new file mode 100644 index 00000000..19f973fd --- /dev/null +++ b/doc/content/templates/_index.md @@ -0,0 +1,6 @@ ++++ +title = "Templates" +[menu.main] +identifier = "templates" +weight = 3 ++++ \ No newline at end of file diff --git a/doc/templates/data.md b/doc/content/templates/data.md similarity index 91% rename from doc/templates/data.md rename to doc/content/templates/data.md index 09e5571f..4330eed4 100644 --- a/doc/templates/data.md +++ b/doc/content/templates/data.md @@ -1,11 +1,10 @@ ---- -layout: default -permalink: templates/data/ -title: Data ---- - -Data -==== ++++ +title = "Data" +linkTitle = "Templates Data" +[menu.main] +parent = "templates" +weight = 2 ++++ It's very common to share application data (variables) with a template. Data can be whatever you want: strings, arrays, objects, etc. Plates allows you set both template specific data as well as shared template data. @@ -30,7 +29,7 @@ $template->data(['name' => 'Jonathan']); ## Accessing data -Template data is available as locally scoped variables at the time of rendering. Continuing with the example above, here is how you would [escape]({{ site.baseurl }}{% link templates/escaping.md %}) and output the "name" value in a template: +Template data is available as locally scoped variables at the time of rendering. Continuing with the example above, here is how you would [escape]({{< relref "templates/escaping.md" >}}) and output the "name" value in a template: ~~~ php

Hello e($name)?>

diff --git a/doc/templates/escaping.md b/doc/content/templates/escaping.md similarity index 89% rename from doc/templates/escaping.md rename to doc/content/templates/escaping.md index b3368c54..8cb44b29 100644 --- a/doc/templates/escaping.md +++ b/doc/content/templates/escaping.md @@ -1,11 +1,10 @@ ---- -layout: default -permalink: templates/escaping/ -title: Escaping ---- - -Escaping -======== ++++ +title = "Escaping" +linkTitle = "Templates Escaping" +[menu.main] +parent = "templates" +weight = 8 ++++ Escaping is a form of [data filtering](http://www.phptherightway.com/#data_filtering) which sanitizes unsafe, user supplied input prior to outputting it as HTML. Plates provides two shortcuts to the `htmlspecialchars()` function. @@ -20,7 +19,7 @@ Escaping is a form of [data filtering](http://www.phptherightway.com/#data_filte ## Batch function calls -The escape functions also support [batch]({{ site.baseurl }}/templates/functions/#batch-function-calls) function calls, which allow you to apply multiple functions, including native PHP functions, to a variable at one time. +The escape functions also support [batch]({{< relref "templates/functions.md#batch-function-calls" >}}) function calls, which allow you to apply multiple functions, including native PHP functions, to a variable at one time. ~~~ php

Welcome e($name, 'strip_tags|strtoupper')?>

diff --git a/doc/templates/functions.md b/doc/content/templates/functions.md similarity index 76% rename from doc/templates/functions.md rename to doc/content/templates/functions.md index 37ca2492..ba41bdb7 100644 --- a/doc/templates/functions.md +++ b/doc/content/templates/functions.md @@ -1,11 +1,10 @@ ---- -layout: default -permalink: templates/functions/ -title: Functions ---- - -Functions -========= ++++ +title = "Functions" +linkTitle = "Templates Functions" +[menu.main] +parent = "templates" +weight = 3 ++++ Template functions in Plates are accessed using the `$this` pseudo-variable. @@ -16,7 +15,7 @@ Template functions in Plates are accessed using the `$this` pseudo-variable. ## Custom fuctions -In addition to the functions included with Plates, it's also possible to add [one-off functions]({{ site.baseurl }}{% link engine/functions.md %}), or even groups of functions, known as [extensions]({{ site.baseurl }}{% link engine/extensions.md %}). +In addition to the functions included with Plates, it's also possible to add [one-off functions]({{< relref "engine/functions.md" >}}), or even groups of functions, known as [extensions]({{< relref "engine/extensions.md" >}}). ## Batch function calls @@ -30,7 +29,7 @@ Sometimes you need to apply more than function to a variable in your templates.

Welcome batch($name, 'strip_tags|strtoupper|escape')?>

~~~ -The [escape]({{ site.baseurl }}{% link templates/escaping.md %}) functions also support batch function calls. +The [escape]({{< relref "templates/escaping.md" >}}) functions also support batch function calls. ~~~ php

Welcome e($name, 'strip_tags|strtoupper')?>

diff --git a/doc/templates/inheritance.md b/doc/content/templates/inheritance.md similarity index 62% rename from doc/templates/inheritance.md rename to doc/content/templates/inheritance.md index 89d65c1b..ede2be2a 100644 --- a/doc/templates/inheritance.md +++ b/doc/content/templates/inheritance.md @@ -1,18 +1,16 @@ ---- -layout: default -permalink: templates/inheritance/ -title: Inheritance ---- - -Inheritance -=========== - -By combining [layouts]({{ site.baseurl }}{% link templates/layouts.md %}) and [sections]({{ site.baseurl }}{% link templates/sections.md %}), Plates allows you to "build up" your pages using predefined sections. This is best understand using an example: ++++ +title = "Inheritance" +linkTitle = "Templates Inheritance" +[menu.main] +parent = "templates" +weight = 7 ++++ +By combining [layouts]({{< relref "templates/layouts.md" >}}) and [sections]({{< relref "templates/sections.md" >}}), Plates allows you to "build up" your pages using predefined sections. This is best understand using an example: ## Inheritance example -The following example illustrates a pretty standard website. Start by creating a site template, which includes your header and footer as well as any predefined content [sections]({{ site.baseurl }}{% link templates/sections.md %}). Notice how Plates makes it possible to even set default section content, in the event that a page doesn't define it. +The following example illustrates a pretty standard website. Start by creating a site template, which includes your header and footer as well as any predefined content [sections]({{< relref "templates/sections.md" >}}). Notice how Plates makes it possible to even set default section content, in the event that a page doesn't define it.
template.php
~~~ php @@ -40,7 +38,7 @@ The following example illustrates a pretty standard website. Start by creating a ~~~ -With the template defined, any page can now "implement" this [layout]({{ site.baseurl }}{% link templates/layouts.md %}). Notice how each section of content is defined between the `start()` and `end()` functions. +With the template defined, any page can now "implement" this [layout]({{< relref "templates/layouts.md" >}}). Notice how each section of content is defined between the `start()` and `end()` functions.
profile.php
~~~ php diff --git a/doc/templates/layouts.md b/doc/content/templates/layouts.md similarity index 89% rename from doc/templates/layouts.md rename to doc/content/templates/layouts.md index e932fcb5..f2969e78 100644 --- a/doc/templates/layouts.md +++ b/doc/content/templates/layouts.md @@ -1,11 +1,10 @@ ---- -layout: default -permalink: templates/layouts/ -title: Layouts ---- - -Layouts -======= ++++ +title = "Layouts" +linkTitle = "Templates Layouts" +[menu.main] +parent = "templates" +weight = 5 ++++ The `layout()` function allows you to define a layout template that a template will implement. It's like having separate header and footer templates in one file. @@ -20,7 +19,7 @@ The `layout()` function can be called anywhere in a template, since the layout t

Hello, e($name)?>

~~~ -This function also works with [folders]({{ site.baseurl }}{% link engine/folders.md %}): +This function also works with [folders]({{< relref "engine/folders.md" >}}): ~~~ php layout('shared::template') ?> @@ -36,7 +35,7 @@ To assign data (variables) to a layout template, pass them as an array to the `l ## Accessing the content -To access the rendered template content within the layout, use the `section()` function, passing `'content'` as the section name. This will return all outputted content from the template that hasn't been defined in a [section]({{ site.baseurl }}{% link templates/sections.md %}). +To access the rendered template content within the layout, use the `section()` function, passing `'content'` as the section name. This will return all outputted content from the template that hasn't been defined in a [section]({{< relref "templates/sections.md" >}}). ~~~ php diff --git a/doc/templates/nesting.md b/doc/content/templates/nesting.md similarity index 81% rename from doc/templates/nesting.md rename to doc/content/templates/nesting.md index 2c8899e4..6243a277 100644 --- a/doc/templates/nesting.md +++ b/doc/content/templates/nesting.md @@ -1,11 +1,10 @@ ---- -layout: default -permalink: templates/nesting/ -title: Nesting ---- - -Nesting -======= ++++ +title = "Nesting" +linkTitle = "Templates Nesting" +[menu.main] +parent = "templates" +weight = 4 ++++ Including another template into the current template is done using the `insert()` function: @@ -17,7 +16,7 @@ Including another template into the current template is done using the `insert() insert('partials/footer') ?> ~~~ -The `insert()` function also works with [folders]({{ site.baseurl }}{% link engine/folders.md %}): +The `insert()` function also works with [folders]({{< relref "engine/folders.md" >}}): ~~~ php insert('partials::header') ?> diff --git a/doc/templates/index.md b/doc/content/templates/overview.md similarity index 81% rename from doc/templates/index.md rename to doc/content/templates/overview.md index 8d96bdfe..e6c7c028 100644 --- a/doc/templates/index.md +++ b/doc/content/templates/overview.md @@ -1,13 +1,12 @@ ---- -layout: default -permalink: templates/ -title: Templates ---- ++++ +title = "Overview" +linkTitle = "Templates Overview" +[menu.main] +parent = "templates" +weight = 1 ++++ -Templates -========= - -Plates templates are very simple PHP objects. Generally you'll want to create these using the two factory methods, `make()` and `render()`, in the [engine]({{ site.baseurl }}{% link engine/index.md %}). For example: +Plates templates are very simple PHP objects. Generally you'll want to create these using the two factory methods, `make()` and `render()`, in the [engine]({{< relref "engine/overview.md" >}}). For example: ~~~ php // Create new Plates instance @@ -20,11 +19,11 @@ echo $templates->render('partials/header'); echo $templates->render('profile', ['name' => 'Jonathan']); ~~~ -For more information about how Plates is designed to be easily added to your application, see the section on [dependency injection]({{ site.baseurl }}/engine/#dependency-injection). +For more information about how Plates is designed to be easily added to your application, see the section on [dependency injection]({{< relref "engine/overview.md#dependency-injection" >}}). ## Manually creating templates -It's also possible to create templates manually. The only dependency they require is an instance of the [engine]({{ site.baseurl }}{% link engine/index.md %}) object. For example: +It's also possible to create templates manually. The only dependency they require is an instance of the [engine]({{< relref "engine/overview.md" >}}) object. For example: ~~~ php // Create new Plates instance diff --git a/doc/templates/sections.md b/doc/content/templates/sections.md similarity index 93% rename from doc/templates/sections.md rename to doc/content/templates/sections.md index f032dda2..06d4151b 100644 --- a/doc/templates/sections.md +++ b/doc/content/templates/sections.md @@ -1,13 +1,12 @@ ---- -layout: default -permalink: templates/sections/ -title: Sections ---- - -Sections -======== - -The `start()` and `stop` functions allow you to build sections (or blocks) of content within your template, and instead of them being rendered directly, they are saved for use elsewhere. For example, in your [layout]({{ site.baseurl }}{% link templates/layouts.md %}) template. ++++ +title = "Sections" +linkTitle = "Templates Sections" +[menu.main] +parent = "templates" +weight = 6 ++++ + +The `start()` and `stop` functions allow you to build sections (or blocks) of content within your template, and instead of them being rendered directly, they are saved for use elsewhere. For example, in your [layout]({{< relref "templates/layouts.md" >}}) template. ## Creating sections diff --git a/doc/templates/syntax.md b/doc/content/templates/syntax.md similarity index 92% rename from doc/templates/syntax.md rename to doc/content/templates/syntax.md index d7ddce04..6edf8812 100644 --- a/doc/templates/syntax.md +++ b/doc/content/templates/syntax.md @@ -1,18 +1,17 @@ ---- -layout: default -permalink: templates/syntax/ -title: Syntax ---- - -Syntax -====== ++++ +title = "Syntax" +linkTitle = "Templates Syntax" +[menu.main] +parent = "templates" +weight = 9 ++++ While the actual syntax you use in your templates is entirely your choice (it's just PHP after all), we suggest the following syntax guidelines to help keep templates clean and legible. ## Guidelines - Always use HTML with inline PHP. Never use blocks of PHP. -- Always escape potentially dangerous variables prior to outputting using the built-in escape functions. More on escaping [here]({{ site.baseurl }}{% link templates/escaping.md %}). +- Always escape potentially dangerous variables prior to outputting using the built-in escape functions. More on escaping [here]({{< relref "templates/escaping.md" >}}). - Always use the short echo syntax (` + + + + + + {{ if .IsHome }} + {{ .Site.Title }} - {{ .Site.Params.tagline }} + {{ else }} + {{ partial "title" . }} | {{ .Site.Title -}} + {{ end }} + {{ if .Site.Params.description }} + + {{ end }} + {{ if .Site.Params.Images.favicon }} + + {{ else }} + + {{ end }} + {{ if .Site.Params.Images.appleTouch }} + + {{ else }} + + {{ end }} + + + + + + + + Fork me on GitHub + + +
+ + The League of Extraordinary Packages + +

Our Packages:

+ +
+ +
+ + + Presented by The League of Extraordinary Packages + +
+ + + + +
+ + {{ $currentPage := . }} + {{ range .Site.Menus.main }} +

{{ .Name }}

+ + {{ end }} +
+
+ {{ template "main" . }} +
+
+ + + + + + + + + +{{ if .Site.GoogleAnalytics }} + +{{ end }} + + + \ No newline at end of file diff --git a/doc/layouts/_default/list.html b/doc/layouts/_default/list.html new file mode 100644 index 00000000..bcd5d0b5 --- /dev/null +++ b/doc/layouts/_default/list.html @@ -0,0 +1,4 @@ +{{ define "main" }} +

{{ .Title }}

+ {{ .Content }} +{{ end }} \ No newline at end of file diff --git a/doc/layouts/_default/single.html b/doc/layouts/_default/single.html new file mode 100644 index 00000000..bcd5d0b5 --- /dev/null +++ b/doc/layouts/_default/single.html @@ -0,0 +1,4 @@ +{{ define "main" }} +

{{ .Title }}

+ {{ .Content }} +{{ end }} \ No newline at end of file diff --git a/doc/layouts/partials/title.html b/doc/layouts/partials/title.html new file mode 100644 index 00000000..7094d8d7 --- /dev/null +++ b/doc/layouts/partials/title.html @@ -0,0 +1,11 @@ +{{ $title := "" }} + +{{ if .Title }} + {{ $title = .Title }} +{{ else if and .IsSection .File }} + {{ $title = path.Base .File.Dir | humanize | title }} +{{ else if and .IsPage .File }} + {{ $title = .File.BaseFileName | humanize | title }} +{{ end }} + +{{ return $title }} \ No newline at end of file diff --git a/doc/CNAME b/doc/static/CNAME similarity index 100% rename from doc/CNAME rename to doc/static/CNAME diff --git a/doc/css/custom.scss b/doc/static/css/custom.css similarity index 97% rename from doc/css/custom.scss rename to doc/static/css/custom.css index 46c10689..a0d462fb 100644 --- a/doc/css/custom.scss +++ b/doc/static/css/custom.css @@ -1,6 +1,3 @@ ---- ---- - .github { position: absolute; top: 0; diff --git a/doc/apple-touch-icon-precomposed.png b/doc/static/favicon/apple-touch-icon-precomposed.png similarity index 100% rename from doc/apple-touch-icon-precomposed.png rename to doc/static/favicon/apple-touch-icon-precomposed.png diff --git a/doc/favicon.ico b/doc/static/favicon/favicon.ico similarity index 100% rename from doc/favicon.ico rename to doc/static/favicon/favicon.ico diff --git a/doc/logo.png b/doc/static/images/logo.png similarity index 100% rename from doc/logo.png rename to doc/static/images/logo.png