Skip to content

Commit a983cd6

Browse files
committed
Docs website: convert to using Jekyll
The initial homepage was set up in HTML as it (temporarily) had to be hosted elsewhere. The intention was always to use GH Pages for hosting the site and to use Jekyll to generate the homepage content based on the `README` of the project. To allow for that to happen, some changes were needed which are contained in this PR. 1. Add a `Gemfile` pointing enabling the GH Pages gem, including enabling a new GH flavoured markdown interpreter. 2. Add a `_config.yml` file. - Enable the new GH flavoured markdown interpreter. - Set the theme. - Enable a variety of plugins. - Add the `repository` and `github` keys to allow for local testing. - Add a range of keys with information for the theme and SEO plugin. - Explicitly exclude a number of files from being included in the generated site. 3. The initial homepage was already based on the GH Pages Jekyll `minimal` theme. To allow the site to take full advantage of that, most copied in files from the theme can be removed as they will automatically be added now, as well as updated when needed. 4. A `.gitignore` file is put in place to ignore the typical Gem related files as well as the Jekyll output in `_site` from being committed. 5. A `.nojekyll` file is put in place in the `phpdoc` subdirectory to prevent Jekyll trying to parse the PHPDocumentor generated documentation. 6. The CSS customizations have been moved from the (theme generated) `style.css` file to `style.scss`. This makes it crystal clear what the customizations are and what comes from the theme. The Jekyll build will combine the CSS into one `style.css` file for the generated site. 7. The theme `_default.html` layout has been copied in from the theme and minimal adjustments have been made to: - Overrule the syntax highlighting styles by setting a separate stylesheet for those. - Add the "Read the docs" button in the left column. - Add the "Install using Composer" section in the left column. - Add the Twitter share button in the left column. 8. Add a `robots.txt` file pointing to the plugin generated XML sitemap fo search engines. 9. Replace the `index.html` file with an `index.md` file which contains the same basic contents as the `README.md` file. Includes making a few small adjustments to the `README.md` file. This should now allow for doing a plain copy & paste of the README content into the `docs/index.md` just before each release to update the homepage to the latest content. Note: there is a "readme to index" plugin available, but that does not allow for the readme and the docs being in different directories. A [feature request](benbalter/jekyll-readme-index#19) to allow for that has been opened. Once this is merged, to update the website means: 1. Running PHPDocumentor. 2. Copy & pasting the content from the `README.md` file to `docs/index.md` (and double-checking the few remaining differences are intact). 3. Once those changes have been merged and `develop` has been merged into `master`, the website should be updated. The website can be viewed locally by running: ```bash bundle update bundle exec jekyll serve ``` and then visiting http://localhost:4000/ to see the result.
1 parent ec02431 commit a983cd6

32 files changed

+408
-1897
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ PHPCSUtils: A suite of utility functions for use with PHP_CodeSniffer
3131
Features
3232
-------------------------------------------
3333

34-
This is a set of utilities to aid developers of sniffs for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
34+
[PHPCSUtils](https://github.com/PHPCSStandards/PHPCSUtils) is a set of utilities to aid developers of sniffs for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
3535

3636
This package offers the following features:
3737

38+
<div id="feature-list">
39+
3840
### Use the latest version of PHP_CodeSniffer native utility functions.
3941

4042
Normally to use the latest version of PHP_CodeSniffer native utility functions, you would have to raise the minimum requirements of your external PHPCS standard.
@@ -71,6 +73,7 @@ A `PHPCS23Utils` standard which allows sniffs to work in both PHPCS 2.x and 3.x,
7173

7274
To see detailed information about all the available abstract sniffs, utility functions and PHPCS helper functions, have a read through the [extensive documentation](https://phpcsutils.com/).
7375

76+
</div>
7477

7578
Minimum Requirements
7679
-------------------------------------------
@@ -216,6 +219,8 @@ Once that's done, you will need to make a small tweak to your own dev environmen
216219
Frequently Asked Questions
217220
-------
218221
222+
<div id="faq">
223+
219224
#### Q: How does this all work without an external standard needing to register an autoloader?
220225
221226
A: As PHPCSUtils is registered with PHPCS as an external standard and PHPCSUtils complies with the naming requirements of PHPCS, the PHPCS native autoloader will automatically take care of loading the classes you use from PHPCSUtils.
@@ -232,6 +237,7 @@ A: The backfill for PHP 7.4 numeric literals with underscores in PHP_CodeSniffer
232237
233238
The backfill was fixed in PHP_CodeSniffer 3.5.4.
234239
240+
</div>
235241
236242
Contributing
237243
-------
@@ -241,4 +247,4 @@ If you are unsure whether the changes you are proposing would be welcome, please
241247
242248
License
243249
-------
244-
This code is released under the GNU Lesser General Public License (LGPLv3). For more information, visit http://www.gnu.org/copyleft/lesser.html
250+
This code is released under the [GNU Lesser General Public License (LGPLv3)](http://www.gnu.org/copyleft/lesser.html).

docs/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
_site/*
2+
Gemfile.lock
3+
.sass-cache
4+
*.gem

docs/Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source 'https://rubygems.org'
2+
3+
gem "github-pages", group: :jekyll_plugins do
4+
gem 'jekyll-commonmark-ghpages'
5+
end

docs/_config.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
baseurl: /
2+
highlighter: rouge
3+
markdown: CommonMarkGhPages
4+
encoding: UTF-8
5+
theme: jekyll-theme-minimal
6+
repository: "PHPCSStandards/PHPCSUtils"
7+
github: [metadata]
8+
url: "https://phpcsutils.com"
9+
10+
plugins:
11+
- jekyll-github-metadata
12+
- jemoji
13+
- jekyll-mentions
14+
- jekyll-seo-tag
15+
- jekyll-sitemap
16+
17+
phpcsutils:
18+
packagist: phpcsstandards/phpcsutils
19+
20+
# Theme info.
21+
title: PHPCSUtils
22+
description: "A suite of utility functions for use with PHP_CodeSniffer."
23+
logo:
24+
show_downloads: false
25+
google_analytics:
26+
27+
# SEO info.
28+
tagline: "PHPCSUtils: A suite of utility functions for use with PHP_CodeSniffer."
29+
twitter:
30+
username: jrf_nl
31+
card: summary
32+
hashtags: PHPCSUtils
33+
author:
34+
twitter: jrf_nl
35+
36+
exclude: ['CNAME', '.gitignore', 'Gemfile', '*.bak', '*.orig']

docs/_layouts/default.html

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!DOCTYPE html>
2+
<html lang="{{ site.lang | default: "en-US" }}">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
8+
{% seo %}
9+
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">
10+
<link rel="stylesheet" href="{{ "/assets/css/syntax.css?v=" | append: site.github.build_revision | relative_url }}">
11+
<!--[if lt IE 9]>
12+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
13+
<![endif]-->
14+
</head>
15+
<body>
16+
<div class="wrapper">
17+
<header>
18+
<h1><a href="{{ "/" | absolute_url }}">{{ site.title | default: site.github.repository_name }}</a></h1>
19+
20+
{% if site.logo %}
21+
<img src="{{site.logo | absolute_url }}" alt="Logo" />
22+
{% endif %}
23+
24+
<p>{{ site.description | default: site.github.project_tagline }}</p>
25+
26+
{% if site.github.is_project_page %}
27+
<p class="view"><a href="{{ site.github.repository_url }}">Visit the Project on GitHub <small>{{ site.github.repository_nwo }}</small></a></p>
28+
{% endif %}
29+
30+
<p class="docs"><a href="{{ "/phpdoc/index.html" | absolute_url }}">Read the Documentation</a></p>
31+
32+
<div class="install">
33+
<a href="https://packagist.org/packages/{{ site.phpcsutils.packagist }}">Install using Composer:</a><br>
34+
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>composer require <span class="s">{{ site.phpcsutils.packagist }}</span></code></pre></div></div>
35+
</div>
36+
37+
{% if site.show_downloads %}
38+
<ul class="downloads">
39+
<li><a href="{{ site.github.zip_url }}">Download <strong>ZIP File</strong></a></li>
40+
<li><a href="{{ site.github.tar_url }}">Download <strong>TAR Ball</strong></a></li>
41+
<li><a href="{{ site.github.repository_url }}">View On <strong>GitHub</strong></a></li>
42+
</ul>
43+
{% endif %}
44+
45+
<p><a href="https://twitter.com/share" class="twitter-share-button" data-related="{{ site.twitter.username }}" data-count="none" data-hashtags="{{ site.twitter.hashtags }}">Tweet about it</a></p>
46+
47+
</header>
48+
49+
</header>
50+
<section>
51+
52+
{{ content }}
53+
54+
</section>
55+
<footer>
56+
{% if site.github.is_project_page %}
57+
<p>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></p>
58+
{% endif %}
59+
<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
60+
</footer>
61+
</div>
62+
63+
<script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script>
64+
{% if site.google_analytics %}
65+
<script>
66+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
67+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
68+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
69+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
70+
ga('create', '{{ site.google_analytics }}', 'auto');
71+
ga('send', 'pageview');
72+
</script>
73+
{% endif %}
74+
75+
<script type="text/javascript">
76+
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
77+
</script>
78+
</body>
79+
</html>

0 commit comments

Comments
 (0)