Skip to content

Commit

Permalink
change from master to main, change to gh-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
htl-leonding committed Nov 14, 2023
1 parent 0906044 commit 73e292b
Show file tree
Hide file tree
Showing 68 changed files with 450 additions and 147 deletions.
2 changes: 0 additions & 2 deletions .env.template

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Docs

on:
push:
branches:
- 'main'
paths:
- asciidocs/**
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build & Publish 🚀
runs-on: ubuntu-latest
env:
INPUTPATH: asciidocs
SLIDES: true
BRANCH: gh-pages
steps:
- uses: actions/checkout@v4

#- name: install packages
# uses: awalsh128/cache-apt-pkgs-action@latest
# with:
# packages: asciidoctor graphviz
# version: 1.0

#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

- name: run docker
run: |
sudo ${{ env.INPUTPATH }}/scripts/docker-convert.sh ${{ env.INPUTPATH }} ${{ env.SLIDES }}
tree
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
# GITHUB_TOKEN: ${{ github.TOKEN }}
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.BRANCH }}
folder: ${{ env.INPUTPATH }}
93 changes: 93 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
= asciidoctor-html-template
Thomas Stütz
1.0.0, {docdate}
:imagesdir: img
:icons: font
:sectnums: // Nummerierung der Überschriften / section numbering
// :toc:
// :toclevels: 1
:experimental:
//https://gist.github.com/dcode/0cfbf2699a1fe9b46ff04c41721dda74?permalink_comment_id=3948218
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]

image::https://img.shields.io/badge/version-1.0.0-blue[]

== doc-as-code

=== Overview

The purpose of this template is to convert adoc-Files to html-Files
These files are divided in html-documents and html-slides. The slides are rendered using https://revealjs.com/[revealjs^].

The convertion of the adoc-files is processed in a docker-container.


image::/img/adoc-to-html.png[]

=== Usage

==== Initial Configuration

* After templating this repo commit and push the demo page

* Set Settings - Pages - Branch: gh-pages - Folder: / (root)
+
[%collapsible]
====
image::/img/permissions-for-asciidoc-2.png[]
====

==== Accessing the Website(s) for docs

* https://*<github-repo-owner>*.github.io/*<github-repo-name>*

** ie https://htl-leonding-college.github.io/asciidoctor-html-template

==== Accessing the Website(s) for slides

* https://*<github-repo-owner>*.github.io/*<github-repo-name>*/demo/*<file-name>*

** ie https://htl-leonding-college.github.io/asciidoctor-html-template/slides/demo.html



==== Remote Rendering by github-actions

When commiting and pushing the adoc-files into github, they are automatically rendered by github-actions to html in a (new) branch `gh-pages`. All sub-folders with adoc-files are included.

==== Local Rendering

Because the rendering with gh-actions on a gh-runner takes time, it is possible to create a local dist-folder with

[source,bash]
----
./local-convert.sh
----

IMPORTANT: You need docker installed locally.

You even can publish your locally created html-slides with

[source,bash]
----
./publish.sh
----



=== Customizing

IMPORTANT: You should not change the scripts in the `asciidocs`-folder, unless you really know what to do.

* The script are available in the `asciidocs`-Folder. So you could change the options for the asciidoctor-engine or the version of revealjs.

=== Docs
** https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/[Asciidoctor Quick Reference]
** https://asciidoctor.org/docs/asciidoc-writers-guide/[AsciiDoc Writer’s Guide^]
** https://docs.asciidoctor.org/reveal.js-converter/latest/converter/features/[Slides with Asciidoctor for revealjs^]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
Empty file.
79 changes: 79 additions & 0 deletions asciidocs/scripts/docker-convert-util.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env bash

convertFilesToSlides() {
buildPath=$1
asciidoctorVersion=$2

echo "=== compiling HTML - slides ==="
echo $buildPath

downloadReveal $buildPath

docker run --rm \
-v ${PWD}/$buildPath/slides:/documents \
asciidoctor/docker-asciidoctor:$asciidoctorVersion /bin/bash -c "asciidoctor-revealjs \
-r asciidoctor-diagram \
-a icons=font \
-a revealjs_theme=league@ \
-a imagesdir=images@ \
-a revealjsdir=revealjs \
-a source-highlighter=rouge@ \
-a revealjs_slideNumber=c/t@ \
-a revealjs_transition=slide@ \
-a revealjs_hash=true@ \
-a sourcedir=src/main/java@ \
-b revealjs \
'**/*.adoc'"
}

downloadReveal() {
buildPath=$1
REVEAL_VERSION="5.0.0"
REVEAL_DIR="$buildPath/slides"
curl -L https://github.com/hakimel/reveal.js/archive/$REVEAL_VERSION.zip --output revealjs.zip
unzip revealjs.zip

mv reveal.js-$REVEAL_VERSION ./$REVEAL_DIR/revealjs
rm revealjs.zip
}



convertFilesToHTML() {
buildPath=$1
asciidoctorVersion=$2

echo "=== compiling HTML - docs ==="
echo $buildPath

docker run --rm \
-v ${PWD}/$buildPath/docs:/documents \
asciidoctor/docker-asciidoctor:$asciidoctorVersion /bin/bash -c "asciidoctor \
-r asciidoctor-diagram \
-a icons=font \
-a experimental=true \
-a source-highlighter=rouge \
-a rouge-theme=github \
-a rouge-linenums-mode=inline \
-a docinfo=shared \
-a imagesdir=images \
-a toc=left \
-a toclevels=2 \
-a sectanchors=true \
-a sectnums=true \
-a favicon=themes/favicon.png \
-a sourcedir=src/main/java \
-b html5 \
'**/*.adoc'"

mv $buildPath/docs/* $buildPath
rmdir $buildPath/docs
# rm -f -v $buildPath/**/*.adoc
#echo $buildPath/**/*.adoc
find $buildPath -depth -name "*.adoc" -print
find $buildPath -depth -name "*.adoc" -delete

#docker run --rm \
# -v ${PWD}/$buildPath:/documents \
# asciidoctor/docker-asciidoctor:1.58 /bin/bash -c "tree && ls -lh"
}
23 changes: 23 additions & 0 deletions asciidocs/scripts/docker-convert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

inputPath="$1"
createSlides="$2"
source $inputPath/scripts/docker-convert-util.sh
ASCIIDOCTOR_VERSION="1.58"

echo "input => $inputPath"
echo "createSlides => $createSlides"
echo building html

if [ $createSlides = true ]; then
convertFilesToSlides "$inputPath" $ASCIIDOCTOR_VERSION
fi

#inputPath="$inputPath"

convertFilesToHTML "$inputPath" $ASCIIDOCTOR_VERSION

# set permissions of output folder to the same as the input folder - fixes #1
#if [ -d "$inputPath" ] && [ -d "$outputPath" ]; then
# chown $(stat "$inputPath" -c %u:%g) "$outputPath" -R
#fi
1 change: 1 addition & 0 deletions asciidocs/slides/css/atom-one-light.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions asciidocs/slides/css/presentation.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*https://github.com/asciidoctor/asciidoctor-reveal.js/issues/199*/
.reveal section img {
border: 0;
box-shadow: none;
}
.font-smaller {
font-size: smaller;
}
.font-larger {
font-size: larger;
}

.reveal .lightbg { background: #fff8f1d0; }
Loading

0 comments on commit 73e292b

Please sign in to comment.