Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
docs: add simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanMertz committed Apr 2, 2019
1 parent 89227c9 commit e16f06e
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Examples

You can test the example by running:

```
cd examples
cargo run -- --filter "<your,tag,filters,here>" --token "<your token here>" template.html > output.html
open output.html
```
92 changes: 92 additions & 0 deletions examples/template.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
body {
background-color: #333;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
margin: 0;
}

table {
border: none;
border-spacing: 20px;
height: 100%;
}

tr {
vertical-align: top;
}

td {
background-color: #FDE8CB;
border-radius: 5px;
box-shadow: 0 0 2px black;
height: 100%;
padding: 20px;
width: 50%;
}

.card {
display: flex;
flex-direction: column;
height: 100%;
justify-content: space-between;
}

.title {
color: #2476AE;
display: block;
margin-bottom: 20px;
text-align: center;
text-decoration: none;
text-transform: capitalize;
width: 100%;
}

.description {
color: #333;
flex: 1;
font-family: "Lucida Grande", serif;
font-size: 0.9em;
font-style: italic;
hyphens: auto;
line-height: 1.6em;
margin: 0 40px;
overflow-wrap: break-word;
text-align: justify;
word-wrap: break-word;
}

.metadata {
font-size: 0.7em;
height: 30px;
margin-right: 37px;
margin-top: 20px;
text-align: right;
}

.metadata span {
background-color: #031528;
border-radius: 3px;
color: #86BC53;
margin: 0 3px;
padding: 3px 5px;
}

.metadata span::before {
color: #f2d87c;
}

.metadata .context::before {
content: "context:";
}

.metadata .medium::before {
content: "medium:";
}

.metadata .language::before {
content: "language:";
}

.metadata .date::before {
content: "date:";
}
50 changes: 50 additions & 0 deletions examples/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Resources: Game Loop</title>
<link rel="stylesheet" href="template.css" />
</head>
<body>
<table>
{% for post in posts -%}

{%- if loop.index0 is even -%}
<tr>
{%- endif -%}

<td>
<div class="card">
<a class="title" href="{{ post.href }}" target="blank">{{ post.description }}</a>
<div class="description">{{ post.extended }}</div>
<div class="metadata">
{% for key, value in post.tags -%}
{% if key == "s" -%}
{% set class = "context" %}
{% elif key == "t" -%}
{% set class = "medium" %}
{% elif key == "l" -%}
{% set class = "language" %}
{% endif -%}

{%- if class is defined -%}
<span class="{{ class }}">{{ value }}</span>
{% endif -%}
{% endfor -%}

<span class="date">{{ post.time }}</span>
</div>
</div>
</td>

{%- if loop.index0 is not even -%}
</tr>
{%- elif loop.last -%}
<td></td>
</tr>
{%- endif -%}

{%- endfor %}
</table>
</body>
</html>

0 comments on commit e16f06e

Please sign in to comment.