Skip to content

Commit

Permalink
Add mkdocs-simple-hooks to run gen_readme script in pre-build
Browse files Browse the repository at this point in the history
  • Loading branch information
athackst committed Apr 7, 2022
1 parent 9adc9ab commit 01ef1e6
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 19 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/publish_docs.yml
Expand Up @@ -15,10 +15,6 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: 3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build Docs
run: ./build.sh
- name: Publish Docs
Expand Down
8 changes: 1 addition & 7 deletions build.sh
Expand Up @@ -3,13 +3,7 @@ set -e
pip install -r requirements.txt
pip install -e .
# md file="build.snippet"
# Building this package requires generating the readme files for the examples.
#
# ```bash
./examples/gen_readme.py
# ```
#
# And then using `mkdocs_simple_gen` to generate the site.
# Building this package simply requires using `mkdocs_simple_gen` to generate the site.
#
# ```bash
mkdocs_simple_gen --build -- --verbose
Expand Down
7 changes: 4 additions & 3 deletions examples/gen_readme.py
@@ -1,12 +1,13 @@
#!/usr/bin/env python3
"""Generate the dockerfiles from a jinja template."""
import os
import logging
from pathlib import Path

from jinja2 import Environment, FileSystemLoader
from markupsafe import Markup

import os
import yaml
import logging


log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/ok-with-mkdocstrings/module.grepout
Expand Up @@ -9,7 +9,7 @@ documentation!</p>


<h3 id="module.main" class="doc doc-heading">
<code class="highlight language-python">module.main()</code>
<code class="highlight language-python"><span class="n">module</span><span class="o">.</span><span class="n">main</span><span class="p">()</span></code>


</h3>
Expand Down
7 changes: 5 additions & 2 deletions mkdocs.yml
@@ -1,16 +1,19 @@
site_name: athackst/mkdocs-simple-plugin
docs_dir: /tmp/mkdocs-simple/mkdocs-simple-plugin
plugins:
- search
- mkdocs-simple-hooks:
hooks:
on_pre_build: examples.gen_readme:generate
- simple:
include_extensions:
- .yml
- .png
- .pages
- .bats
- .sh
- macros
- awesome-pages
- macros
- search
edit_uri: ''
site_url: https://athackst.github.io/mkdocs-simple-plugin
repo_url: https://github.com/athackst/mkdocs-simple-plugin
Expand Down
2 changes: 1 addition & 1 deletion tests/run_integration_tests.sh
Expand Up @@ -2,7 +2,7 @@
set -e
sudo apt-get install bats
pip install -e .
pip install mkdocs-macros-plugin mkdocstrings
pip install mkdocs-macros-plugin mkdocstrings mkdocs-material
# md file="test.snippet"
# ### Integration tests
#
Expand Down
2 changes: 1 addition & 1 deletion tests/test_local.sh
Expand Up @@ -22,7 +22,7 @@ set -e
function docker_run_integration_tests() {
docker build -t mkdocs-simple-test-runner:$1 -f- . <<EOF
FROM python:$1
RUN apt-get -y update && apt-get -yyy install bats gcc sudo
RUN apt-get -y update && apt-get -y install bats gcc sudo
COPY . /workspace
WORKDIR /workspace
EOF
Expand Down

0 comments on commit 01ef1e6

Please sign in to comment.