From 52354f070c3f1f842860fbeafe8e627254eb3934 Mon Sep 17 00:00:00 2001 From: chevdor Date: Tue, 8 Jun 2021 21:09:18 +0200 Subject: [PATCH] docs: move the asciidoc readme so github does not pick it up by default --- .github/workflows/build-readme.yml | 2 +- README.md | 23 ++++++++++++++++++++--- README.adoc => README_src.adoc | 0 justfile | 2 +- src/main.rs | 2 +- src/template.rs | 8 ++++---- 6 files changed, 27 insertions(+), 10 deletions(-) rename README.adoc => README_src.adoc (100%) diff --git a/.github/workflows/build-readme.yml b/.github/workflows/build-readme.yml index 9c18966..e689914 100644 --- a/.github/workflows/build-readme.yml +++ b/.github/workflows/build-readme.yml @@ -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 diff --git a/README.md b/README.md index 0f605fc..659a958 100644 --- a/README.md +++ b/README.md @@ -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"] } ] } @@ -27,7 +29,10 @@ as well as a template such as: {% block title %} {{title}} {% endblock title %} @@ -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 diff --git a/README.adoc b/README_src.adoc similarity index 100% rename from README.adoc rename to README_src.adoc diff --git a/justfile b/justfile index b76fd5d..af48405 100644 --- a/justfile +++ b/justfile @@ -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: diff --git a/src/main.rs b/src/main.rs index 251b17a..e59e569 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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> { diff --git a/src/template.rs b/src/template.rs index e055f8b..5778939 100644 --- a/src/template.rs +++ b/src/template.rs @@ -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 { - fs::read_to_string(path) - } + pub fn load(path: &Path) -> io::Result { + fs::read_to_string(path) + } }