Skip to content

Commit

Permalink
docs: move the asciidoc readme so github does not pick it up by default
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Jun 8, 2021
1 parent d7bd3a6 commit 52354f0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
id: adocbuild
uses: chevdor/asciidoctor-action@master
with:
program: "asciidoctor -b docbook -a leveloffset=+1 -o - README.adoc | pandoc --markdown-headings=atx --wrap=preserve -t markdown_strict -f docbook - > README.md"
program: "asciidoctor -b docbook -a leveloffset=+1 -o - README_src.adoc | pandoc --markdown-headings=atx --wrap=preserve -t markdown_strict -f docbook - > README.md"
- name: Print execution time
run: echo "Time ${{ steps.adocbuild.outputs.time }}"
- name: Deploy docs to ghpages
Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ Here is a basic example. For instance, you will pass data such as:
"users": [
{
"username": "Alice",
"url": "http://example.org/alice"
"url": "http://example.org/alice",
"fav_colors": ["red", "green", "yellow"]
},
{
"username": "Bob",
"url": "http://example.org/bob"
"url": "http://example.org/bob",
"fav_colors": ["orange"]
}
]
}
Expand All @@ -27,7 +29,10 @@ as well as a template such as:
<title>{% block title %} {{title}} {% endblock title %}</title>

<ul>
{% for user in users %} <li><a href="{{ user.url }}">{{ user.username }}</a></li>
{% for user in users -%}
<li><a href="{{ user.url }}">{{ user.username }}
{{ user.username }} likes {% for color in user.fav_colors -%}{{ color }} {% endfor %}
</a></li>
{% endfor %}
</ul>

Expand Down Expand Up @@ -62,6 +67,18 @@ The **tera** engine allows way more than the simple replacements shown above. Yo

cargo install --git https://github.com/chevdor/tera-cli

## What can I do with that anyway ?

Well…​ if you have **data** and you want to format them, this tool will likely be a great companion.

- You may generate beautiful changelogs in markdown, asciidoc, restructured text, etc…​

- You may generate some more human views of your data

- You may…​ make a blog with that…​

- You may generate k8s config files…​.

## Features

### Supported formats
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default:
# Generate the readme as .md
md:
#!/usr/bin/env bash
asciidoctor -b docbook -a leveloffset=+1 -o - README.adoc | pandoc --markdown-headings=atx --wrap=preserve -t markdown_strict -f docbook - > README.md
asciidoctor -b docbook -a leveloffset=+1 -o - README_src.adoc | pandoc --markdown-headings=atx --wrap=preserve -t markdown_strict -f docbook - > README.md
# Generate usage samples
_usage:
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ mod opts;
mod template;
mod wrapped_context;

use std::{fs::File, io::Write};
use crate::template::Template;
use clap::{crate_name, crate_version, Clap};
use env_logger::Env;
use log::{debug, info, trace};
use opts::*;
use std::{fs::File, io::Write};
use tera::{Context, Tera};

fn main() -> Result<(), String> {
Expand Down
8 changes: 4 additions & 4 deletions src/template.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{fs, io, path::PathBuf};
use std::{fs, io, path::Path};

pub struct Template;

impl Template {
pub fn load(path: &PathBuf) -> io::Result<String> {
fs::read_to_string(path)
}
pub fn load(path: &Path) -> io::Result<String> {
fs::read_to_string(path)
}
}

0 comments on commit 52354f0

Please sign in to comment.