Skip to content

Commit

Permalink
Add proper prod layout, inc compressing
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielOaks committed Oct 16, 2018
1 parent f0266c0 commit d8563c1
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 62 deletions.
10 changes: 10 additions & 0 deletions _config-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ exclude:
- Gemfile.lock
- README.md

compress_html:
clippings: []
comments: ["<!-- ", " -->"]
endings: []
ignore:
envs: [local]
blanklines: true
profile: false
startings: []

sass:
sass_dir: css

Expand Down
10 changes: 10 additions & 0 deletions _config-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ exclude:
- Gemfile.lock
- README.md

compress_html:
clippings: []
comments: ["<!-- ", " -->"]
endings: []
ignore:
envs: [local]
blanklines: true
profile: false
startings: []

sass:
sass_dir: css

Expand Down
30 changes: 1 addition & 29 deletions _includes/layouts/prod-default.html
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<title>{{ page.title }}</title>

<!-- Homepage CSS -->
<link href="/css/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />

<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<nav>
<div class="wrapper">
PROD Developer Docs
</div>
</nav>
<div id="content">
<div class="wrapper">
{{ content }}
</div>
</div>
<footer>
<div class="wrapper">
PROD Developer Docs
</div>
</footer>
</body>
</html>
{{ content }}
60 changes: 32 additions & 28 deletions _layouts/command.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
layout: short-header
---
<div class="row">
<div class="col-sm-3 sidebar">
<div class="col-sm-4 col-xs-12 sidebar">
<div class="breadcrumbs">
<ul>
<li><a href="">IRC Technology</a> ></li>
<li><a href="">Commands</a> ></li>
<li><a href="">IRC Technology</a> &gt;</li>
<li><a href="">Commands</a> &gt;</li>
<li><b>{{ page.command }}</b></li>
</ul>
</div>
{% if page.related-commands %}
<hr>
<p class="title">Related Commands:</p>
{% for cmd in page.related-commands %}
<a class="sidebar-page-link" href="{{ cmd | slugify }}"><code>{{ cmd }}</code></a>
<a class="sidebar-page-link" href="{{ cmd | slugify }}.html"><code>{{ cmd }}</code></a>
{% endfor %}
{% endif %}

Expand All @@ -32,7 +32,7 @@
<hr>
<p class="title">{{ gdata.name }}</p>
{% for cmd in cmds %}
<a class="sidebar-page-link" href="{{ cmd | slugify }}"><code>{{ cmd }}</code></a>
<a class="sidebar-page-link" href="{{ cmd | slugify }}.html"><code>{{ cmd }}</code></a>
{% endfor %}
{% endif %}
{% endif %}
Expand Down Expand Up @@ -106,7 +106,7 @@
<a href="btn">Example Link Name!</a>
</div>
</div>
<div class="col-sm-9 main-content">
<div class="col-sm-8 col-xs-12 main-content">
<div class="content">
{% if page.experimental %}
<div class="alert alert-warning experimental">
Expand Down Expand Up @@ -137,26 +137,30 @@ <h3 id="compatibility">Compatibility<a href="/#compatibility" class="link-icon">
<div class="alert alert-warning">
Your IRC client may or may not have in-built support for this command.
</div>
<table class="supported-table">
<thead>
<th style="min-width:120px"></th>
{% for server in site.data.supported-servers.shortlist %}
<th>{{ server.name }}</th>
{% endfor %}
</thead>
<tbody>
<tr>
<td>Supported:</td>
{% for server in site.data.supported-servers.shortlist %}
{% if page.supported-by[server.id] %}
<td class="supported"><i class="fas fa-check"></i></td>
{% else %}
<td class="not-supported"><i class="fas fa-times"></i></td>
{% endif %}
{% endfor %}
</tr>
</tbody>
</table>
<div class="comptability-table-wrapper">
<table class="supported-table">
<thead>
<tr>
<th style="min-width:120px"></th>
{% for server in site.data.supported-servers.shortlist %}
<th>{{ server.name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
<tr>
<td>Supported:</td>
{% for server in site.data.supported-servers.shortlist %}
{% if page.supported-by[server.id] %}
<td class="supported"><i class="fas fa-check"></i></td>
{% else %}
<td class="not-supported"><i class="fas fa-times"></i></td>
{% endif %}
{% endfor %}
</tr>
</tbody>
</table>
</div>
<hr>

<h3 id="numerics">Related Numerics<a href="/#numerics" class="link-icon"><i class="fas fa-link"></i></a></h3>
Expand All @@ -180,8 +184,8 @@ <h3 id="numerics">Related Numerics<a href="/#numerics" class="link-icon"><i clas
<hr>

<h3 id="referenceThisIDinURl">See Also:<a href="/#referneceThisDivinURl" class="link-icon"><i class="fas fa-link"></i></a></h3>
<a href="#"><code>> This interesting function();</code></a><br>
<a href="#"><code>> This interesting function();</code></a><br>
<a href="#"><code>&gt; This interesting function();</code></a><br>
<a href="#"><code>&gt; This interesting function();</code></a><br>
</div>
</div>
</div>
10 changes: 10 additions & 0 deletions _layouts/compress.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# Jekyll layout that compresses HTML
# v3.0.4
# http://jch.penibelst.de/
# © 2014–2015 Anatol Broder
# MIT License
---

{% capture _LINE_FEED %}
{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment %}{{ content }}{% else %}{% capture _content %}{{ content }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _end %}</{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _end %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "<!-- -->" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "<pre" %}{% assign _content = "" %}{% for _pre_before in _pre_befores %}{% assign _pres = _pre_before | split: "</pre>" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "</pre>" %}<pre{{ _pres.first }}</pre>{% endif %}{% unless _pre_before contains "</pre>" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " <e;<e; </e>;</e>;</e> ;</e>" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %} <table id="compress_html_profile_{{ site.time | date: "%Y%m%d" }}" class="compress_html_profile"> <thead> <tr> <td>Step <td>Bytes <tbody> <tr> <td>raw <td>{{ content | size }}{% if _profile_endings %} <tr> <td>endings <td>{{ _profile_endings }}{% endif %}{% if _profile_startings %} <tr> <td>startings <td>{{ _profile_startings }}{% endif %}{% if _profile_comments %} <tr> <td>comments <td>{{ _profile_comments }}{% endif %}{% if _profile_collapse %} <tr> <td>collapse <td>{{ _profile_collapse }}{% endif %}{% if _profile_clippings %} <tr> <td>clippings <td>{{ _profile_clippings }}{% endif %} </table>{% endif %}{% endif %}
9 changes: 4 additions & 5 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% if site.mode == "dev" %}
{% include layouts/dev-default.html %}
{% else %}
{% include layouts/prod-default.html %}
{% endif %}
---
layout: compress
---
{% if site.mode == "dev" %}{% include layouts/dev-default.html %}{% else %}{% include layouts/prod-default.html %}{% endif %}

0 comments on commit d8563c1

Please sign in to comment.