Documentation. (#12)

* First docs.

* Docs requirements.

* Add auto-generated gallery and fix two bugs in the driver.

* Gallery: link directly to github.

* Tag examples as Haskell code.

* Update starting guide and redirect gallery links to master branch.

* Include link to readthedocs.


Former-commit-id: 90e846e5001deadd6c921f611c69b3a4210db30d
This commit is contained in:
David Himmelstrup 2019-09-19 16:52:34 +08:00 committed by GitHub
commit 23146429a5
9 changed files with 268 additions and 3 deletions

3
docs/fix.css Normal file
View file

@ -0,0 +1,3 @@
pre code {
white-space: pre !important;
}

183
docs/gallery.md Normal file
View file

@ -0,0 +1,183 @@
# Gallery
This file is auto-generated by docs/render_all.sh. DO NOT EDIT.
## boundingbox
<details>
<summary>View boundingbox.hs</summary>
<pre><code class="haskell">
{!examples/boundingbox.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/boundingbox.mp4">
</video>
<br/><hr><br/>
## colormaps
<details>
<summary>View colormaps.hs</summary>
<pre><code class="haskell">
{!examples/colormaps.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/colormaps.mp4">
</video>
<br/><hr><br/>
## goo
<details>
<summary>View goo.hs</summary>
<pre><code class="haskell">
{!examples/goo.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/goo.mp4">
</video>
<br/><hr><br/>
## latex_basic
<details>
<summary>View latex_basic.hs</summary>
<pre><code class="haskell">
{!examples/latex_basic.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/latex_basic.mp4">
</video>
<br/><hr><br/>
## latex_color
<details>
<summary>View latex_color.hs</summary>
<pre><code class="haskell">
{!examples/latex_color.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/latex_color.mp4">
</video>
<br/><hr><br/>
## latex_draw
<details>
<summary>View latex_draw.hs</summary>
<pre><code class="haskell">
{!examples/latex_draw.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/latex_draw.mp4">
</video>
<br/><hr><br/>
## latex_wheel
<details>
<summary>View latex_wheel.hs</summary>
<pre><code class="haskell">
{!examples/latex_wheel.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/latex_wheel.mp4">
</video>
<br/><hr><br/>
## raster
<details>
<summary>View raster.hs</summary>
<pre><code class="haskell">
{!examples/raster.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/raster.mp4">
</video>
<br/><hr><br/>
## sphere
<details>
<summary>View sphere.hs</summary>
<pre><code class="haskell">
{!examples/sphere.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/sphere.mp4">
</video>
<br/><hr><br/>
## sunflower
<details>
<summary>View sunflower.hs</summary>
<pre><code class="haskell">
{!examples/sunflower.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/sunflower.mp4">
</video>
<br/><hr><br/>
## tangent_and_normal
<details>
<summary>View tangent_and_normal.hs</summary>
<pre><code class="haskell">
{!examples/tangent_and_normal.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/tangent_and_normal.mp4">
</video>
<br/><hr><br/>
## vector_field
<details>
<summary>View vector_field.hs</summary>
<pre><code class="haskell">
{!examples/vector_field.hs!}
</code></pre>
</details>
<br/>
<video width="640" height="360" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/vector_field.mp4">
</video>
<br/><hr><br/>

24
docs/index.md Normal file
View file

@ -0,0 +1,24 @@
# Getting started
## Viewing a basic animation
```console
$ git clone https://github.com/Lemmih/reanimate.git
$ cd reanimate/
$ stack build
$ stack ./examples/raster.hs
```
## Checking dependencies
Reanimate includes a run-time for optional dependencies.
```console
$ stack ./examples/raster.hs check
```
## Rendering movies
```console
$ stack ./examples/raster.hs render
```

44
docs/render_all.sh Executable file
View file

@ -0,0 +1,44 @@
#!/usr/bin/env bash
EXAMPLES='boundingbox colormaps goo latex_basic latex_color latex_draw
latex_wheel raster sphere sunflower tangent_and_normal vector_field'
WIDTH=640
HEIGHT=$((WIDTH*9/16))
FPS=30
SRC_DIR=examples
DST_DIR=docs/rendered
OPTS='--fps $FPS --width $WIDTH --height $HEIGHT'
cat << EOF > docs/gallery.md
# Gallery
This file is auto-generated by docs/render_all.sh. DO NOT EDIT.
EOF
for e in $EXAMPLES; do
cat << EOF >> docs/gallery.md
## $e
<details>
<summary>View $e.hs</summary>
<pre><code class="haskell">
{!examples/$e.hs!}
</code></pre>
</details>
<br/>
<video width="$WIDTH" height="$HEIGHT" autoplay loop>
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/$e.mp4">
</video>
<br/><hr><br/>
EOF
SRC_FILE=./$SRC_DIR/$e.hs
DST_FILE=./$DST_DIR/$e.mp4
if [[ "$SRC_FILE" -nt "$DST_FILE" ]]; then
stack $SRC_FILE render --compile -o $DST_FILE $OPTS
fi
done

1
docs/requirements.txt Normal file
View file

@ -0,0 +1 @@
markdown_include==0.5.1