Skip to content

Commit

Permalink
Improve buildah.io ui experience (#76)
Browse files Browse the repository at this point in the history
* add 404 error page

Signed-off-by: Paul Holzinger <[email protected]>

* add gitignore file

Signed-off-by: Paul Holzinger <[email protected]>

* Show double curly braces in output

escape them with '{% raw %}{{ abc }}{% endraw %}' syntax
so jekyll doesn't interpret them as variable and omits them

Signed-off-by: Paul Holzinger <[email protected]>

* add anchor headings

see: github.com/allejo/jekyll-anchor-headings

convert html to markdown to support anchor headings

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 authored Aug 8, 2020
1 parent f5ee316 commit db9b81f
Show file tree
Hide file tree
Showing 12 changed files with 234 additions and 50 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.jekyll-cache
_site
12 changes: 12 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
permalink: /404.html
layout: default
---

<div>
<img src="{{ site.baseurl }}/images/buildah.png" alt="buildah logo">
<h1>404</h1>

<p><strong>Page not found :(</strong></p>
<p>Click <a href="{{ site.baseurl }}/">here</a> to go to the start page.</p>
</div>
128 changes: 128 additions & 0 deletions _includes/anchor_headings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{% capture headingsWorkspace %}
{% comment %}
Copyright (c) 2018 Vladimir "allejo" Jimenez

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
{% endcomment %}
{% comment %}
Version 1.0.6
https://github.com/allejo/jekyll-anchor-headings

"Be the pull request you wish to see in the world." ~Ben Balter

Usage:
{% include anchor_headings.html html=content anchorBody="#" %}

Parameters:
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll

Optional Parameters:
* beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content
* anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`;
the `%heading%` placeholder is available
* anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available
* anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space
* anchorTitle (string) : '' - The `title` attribute that will be used for anchors
* h_min (int) : 1 - The minimum header level to build an anchor for; any header lower than this value will be ignored
* h_max (int) : 6 - The maximum header level to build an anchor for; any header greater than this value will be ignored
* bodyPrefix (string) : '' - Anything that should be inserted inside of the heading tag _before_ its anchor and content
* bodySuffix (string) : '' - Anything that should be inserted inside of the heading tag _after_ its anchor and content

Output:
The original HTML with the addition of anchors inside of all of the h1-h6 headings.
{% endcomment %}

{% assign minHeader = include.h_min | default: 1 %}
{% assign maxHeader = include.h_max | default: 6 %}
{% assign beforeHeading = include.beforeHeading %}
{% assign nodes = include.html | split: '<h' %}

{% capture edited_headings %}{% endcapture %}

{% for _node in nodes %}
{% capture node %}{{ _node | strip }}{% endcapture %}

{% if node == "" %}
{% continue %}
{% endif %}

{% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %}
{% assign headerLevel = nextChar | times: 1 %}

<!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's see if we need to fix it -->
{% if headerLevel == 0 %}
<!-- Split up the node based on closing angle brackets and get the first one. -->
{% assign firstChunk = node | split: '>' | first %}

<!-- If the first chunk does NOT contain a '<', that means we've broken another HTML tag that starts with 'h' -->
{% unless firstChunk contains '<' %}
{% capture node %}<h{{ node }}{% endcapture %}
{% endunless %}

{% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
{% continue %}
{% endif %}

{% assign _workspace = node | split: '</h' %}
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
{% assign html_id = _idWorkspace[0] %}

{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}

<!-- Build the anchor to inject for our heading -->
{% capture anchor %}{% endcapture %}

{% if html_id and headerLevel >= minHeader and headerLevel <= maxHeader %}
{% capture anchor %}href="#{{ html_id }}"{% endcapture %}

{% if include.anchorClass %}
{% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %}
{% endif %}

{% if include.anchorTitle %}
{% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', header }}"{% endcapture %}
{% endif %}

{% if include.anchorAttrs %}
{% capture anchor %}{{ anchor }} {{ include.anchorAttrs | replace: '%heading%', header }}{% endcapture %}
{% endif %}

{% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %}

{% endif %}

{% capture new_heading %}
<h{{ _hAttrToStrip }}
{{ include.bodyPrefix }}
{% if beforeHeading %}
{{ anchor }}{{ header }}
{% else %}
{{ header }}{{ anchor }}
{% endif %}
{{ include.bodySuffix }}
</h{{ _workspace | last }}
{% endcapture %}
{% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
{% endfor %}
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1 class="header"><a href="https://buildah.io">Buildah</a></h1>
</header>

<section>
{{ content }}
{% include anchor_headings.html html=content beforeHeading=true h_max=3 anchorBody="<svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>" %}
</section>
</div>
<!--[if !IE]><script>fixScale(document);</script><![endif]-->
Expand Down
6 changes: 3 additions & 3 deletions _posts/2018-10-09-buildah-blocks-on-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Now to create the first container and verify that ONBUILD has been set:

```
# buildah bud --format=docker -f Dockerfile -t onbuild-image .
# buildah inspect --format '{{.Docker.Config.OnBuild}}' onbuild-image
# buildah inspect --format {% raw %}'{{.Docker.Config.OnBuild}}'{% endraw %} onbuild-image
[RUN touch /bar]
```

Expand Down Expand Up @@ -97,7 +97,7 @@ First a Fedora container will be created with `buildah from`, then the `/foo` fi
# buildah config --onbuild="RUN touch /bar" onbuild-container
# buildah commit --format=docker onbuild-container onbuild-image
{output edited for brevity}
# buildah inspect --format '{{.Docker.Config.OnBuild}}' onbuild-image
# buildah inspect --format {% raw %}'{{.Docker.Config.OnBuild}}'{% endraw %} onbuild-image
[RUN touch /bar]
```
The onbuild-image has been created, so now create a container from it using the same commands as the first example using the second Dockerfile:
Expand Down Expand Up @@ -150,7 +150,7 @@ onbuild-container-2
# buildah config --onbuild="RUN /usr/bin/runecho.sh" onbuild-container-2
# buildah commit --format=docker onbuild-container-2 onbuild-image-2
{output edited for brevity}
# buildah inspect --format '{{.Docker.Config.OnBuild}}' onbuild-image-2
# buildah inspect --format {% raw %}'{{.Docker.Config.OnBuild}}'{% endraw %} onbuild-image-2
[COPY ./runecho.sh /usr/bin/runecho.sh RUN /usr/bin/runecho.sh &> /tmp/runecho.txt]
```

Expand Down
46 changes: 46 additions & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,49 @@ img {
height: auto;
width: auto\9;
}

/* anchor headings */
h1 {
margin-left: -20px;
padding-left: 10px;
}

h2 {
margin-left: -18px;
padding-left: 10px;
}

h3 {
margin-left: -16px;
padding-left: 10px;
}

h4 {
margin-left: -14px;
padding-left: 10px;
}

h5 {
margin-left: -12px;
padding-left: 10px;
}

h6 {
margin-left: -10px;
padding-left: 10px;
}

h1 .octicon, h2 .octicon, h3 .octicon, h4 .octicon, h5 .octicon, h6 .octicon {
visibility: hidden;
}

h1:hover .octicon, h2:hover .octicon, h3:hover .octicon, h4:hover .octicon, h5:hover .octicon, h6:hover .octicon {
visibility: visible;
}

.octicon {
fill: currentColor;
padding: 0;
margin-left: -16px;
vertical-align: middle;
}
14 changes: 0 additions & 14 deletions blogs/index.html

This file was deleted.

14 changes: 14 additions & 0 deletions blogs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
layout: default
title: Buildah Blogs
---

![Buildah logo](../images/buildah.png)

# {{ page.title }}

<section class="posts">
{% for post in site.categories.blogs %}
<p><h3><a href="{{ site.baseurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a><br><span>{{ post.date | date_to_string }}</span> by {{ post.author }}</h3></p>
{% endfor %}
</section>
13 changes: 7 additions & 6 deletions index.html → index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico">
</head>
<h1>{{ page.title }}</h1>

Welcome to the site for <a href="https://github.com/containers/buildah/blob/master/README.md">Buildah</a>. This site features announcements and news around Buildah, and occasionally other <a href="https://github.com/containers/">container tooling</a> news.
# {{ page.title }}

<img src="images/buildah.png" alt="Buildah logo">
Welcome to the site for [Buildah](https://github.com/containers/buildah/blob/master/README.md). This site features announcements and news around Buildah, and occasionally other [container tooling](https://github.com/containers/) news.

<h2>What's New!</h2>
![Buildah logo](images/buildah.png)

## What's New!

<section class="posts">
{% for post in site.categories.new %}
<p><span>{{ post.date | date_to_string }}</span> » <a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></p>
<p><span>{{ post.date | date_to_string }}</span> » <a href="{{ site.baseurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></p>
<p>{{ post.excerpt }}</p><hr>
{% endfor %}
</section>

<h4>Now where is that Container Commandos <a href=https://github.com/mairin/coloringbook-container-commandos/blob/master/Web.pdf>Coloring Book</a>?</h4>
#### Now where is that Container Commandos [Coloring Book](https://github.com/mairin/coloringbook-container-commandos/blob/master/Web.pdf)?
22 changes: 0 additions & 22 deletions mailinglist/index.html

This file was deleted.

17 changes: 17 additions & 0 deletions mailinglist/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: default
title: Buildah Mailing List
---

![Buildah logo](../images/buildah.png)

# {{ page.title }}

A mailing list is now available for your questions, concerns or comments about Buildah. There are two methods that can be used to subscribe to it.

1. Send an email to [[email protected]](mailto: [email protected]?subject=subscribe) with the word "Subscribe" in the subject.
2. Go to this [page](https://lists.podman.io/admin/lists/buildah.lists.buildah.io/), then scroll down to the bottom of the page and enter your email and optionally name, then click on the "Subscribe" buton.

Regardless of which method you use, a confirmation email will be sent to you. After you reply back to that confirmation email, you'll then be able to send mail directly to [[email protected]](mailto: [email protected]). You can then also go to the list's [web page](https://lists.podman.io/archives/list/[email protected]/) and from there you can see all of the past conversations on the list or manage your subscription.

Please note, if you have a bug that you'd like to report, it's best to report them [here](https://github.com/containers/buildah/issues) by creating a "New issue" rather than sending an email to the list.
8 changes: 4 additions & 4 deletions releases/index.html → releases/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
title: Buildah Release Announcements
---

<img src="https://buildah.io/images/buildah.png" alt="Buildah logo">
![Buildah logo](../images/buildah.png)

<h1>{{ page.title }}</h1>
# {{ page.title }}

<section class="posts">
{% for post in site.categories.releases %}
<p><span>{{ post.date | date_to_string }}</span> » <a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> by {{ post.author }}</p>
<p><span>{{ post.date | date_to_string }}</span> » <a href="{{ site.baseurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> by {{ post.author }}</p>
<p>{{ post.excerpt }}</p>
<a href="{{post.url}}"> Read More </a><hr>
<a href="{{ site.baseurl }}{{post.url}}"> Read More </a><hr>
{% endfor %}
</section>

0 comments on commit db9b81f

Please sign in to comment.