summaryrefslogtreecommitdiff
path: root/python-mkdocs-simple-hooks.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-mkdocs-simple-hooks.spec')
-rw-r--r--python-mkdocs-simple-hooks.spec321
1 files changed, 321 insertions, 0 deletions
diff --git a/python-mkdocs-simple-hooks.spec b/python-mkdocs-simple-hooks.spec
new file mode 100644
index 0000000..0ce7574
--- /dev/null
+++ b/python-mkdocs-simple-hooks.spec
@@ -0,0 +1,321 @@
+%global _empty_manifest_terminate_build 0
+Name: python-mkdocs-simple-hooks
+Version: 0.1.5
+Release: 1
+Summary: Define your own hooks for mkdocs, without having to create a new package.
+License: MIT
+URL: https://github.com/aklajnert/mkdocs-simple-hooks
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f1/93/565f98d6810e3b493e61160aea1cceb8653331576e7fa7f048ac7e7cdf62/mkdocs-simple-hooks-0.1.5.tar.gz
+BuildArch: noarch
+
+Requires: python3-mkdocs
+Requires: python3-pytest
+Requires: python3-pytest-cov
+
+%description
+# mkdocs-simple-hooks
+
+Define your own hooks for mkdocs, without having to create a new package.
+
+## Setup
+
+Install the plugin using pip:
+
+```bash
+pip install mkdocs-simple-hooks
+```
+
+Next, add a python module to either the `docs/` directory or the root mkdocs directory. Then, add the plugin and hooks definition to your `mkdocs.yml`:
+
+```yaml
+plugins:
+ - search
+ - mkdocs-simple-hooks:
+ hooks:
+ hook-name: "your.module:hook_function"
+```
+
+> If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set.
+
+More information about plugins in the [MkDocs documentation][mkdocs-plugins].
+
+## Usage
+
+You can use this plugin to create simple hooks for `mkdocs` without having to create
+a separate plugin package.
+
+Just define a function and register it as a hook in the `mkdocs.yml`. The function shall
+have the same API as the desired hook. To see available hooks and their API, see the
+events chapter in the [mkdocs documentation][mkdocs-hooks].
+
+## Example
+
+Let's say you want to copy the `README.md` file to `docs/index.md`. To do that, create
+a new file, e.g.: `docs/hooks.py`, and put the following function there:
+
+```python
+import shutil
+
+def copy_readme(*args, **kwargs):
+ shutil.copy("README.md", "docs/index.md")
+```
+
+Now, register the hook in your `mkdocs.yml`:
+
+```yaml
+plugins:
+ - mkdocs-simple-hooks:
+ hooks:
+ on_pre_build: "docs.hooks:copy_readme"
+```
+
+That's all - the `copy_readme()` function will run every time, before building the documentation.
+
+
+## Disabling the plugin
+
+You can use the `enabled` option to optionally disable this plugin. A possible use case is local development where you might want faster build times. It's recommended to use this option with an environment variable together with a default fallback (introduced in `mkdocs` v1.2.1, see [docs](https://www.mkdocs.org/user-guide/configuration/#environment-variables)). Example:
+
+```yaml
+plugins:
+ - mkdocs-simple-hooks:
+ enabled: !ENV [ENABLE_MKDOCS_SIMPLE_HOOKS, True]
+ hooks:
+ on_pre_build: "docs.hooks:copy_readme"
+```
+
+Which enables you to disable the plugin locally using:
+
+```bash
+export ENABLE_MKDOCS_SIMPLE_HOOKS=false
+mkdocs serve
+```
+
+[mkdocs-plugins]: http://www.mkdocs.org/user-guide/plugins/
+[mkdocs-hooks]: https://www.mkdocs.org/user-guide/plugins/#events
+
+
+
+
+%package -n python3-mkdocs-simple-hooks
+Summary: Define your own hooks for mkdocs, without having to create a new package.
+Provides: python-mkdocs-simple-hooks
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-mkdocs-simple-hooks
+# mkdocs-simple-hooks
+
+Define your own hooks for mkdocs, without having to create a new package.
+
+## Setup
+
+Install the plugin using pip:
+
+```bash
+pip install mkdocs-simple-hooks
+```
+
+Next, add a python module to either the `docs/` directory or the root mkdocs directory. Then, add the plugin and hooks definition to your `mkdocs.yml`:
+
+```yaml
+plugins:
+ - search
+ - mkdocs-simple-hooks:
+ hooks:
+ hook-name: "your.module:hook_function"
+```
+
+> If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set.
+
+More information about plugins in the [MkDocs documentation][mkdocs-plugins].
+
+## Usage
+
+You can use this plugin to create simple hooks for `mkdocs` without having to create
+a separate plugin package.
+
+Just define a function and register it as a hook in the `mkdocs.yml`. The function shall
+have the same API as the desired hook. To see available hooks and their API, see the
+events chapter in the [mkdocs documentation][mkdocs-hooks].
+
+## Example
+
+Let's say you want to copy the `README.md` file to `docs/index.md`. To do that, create
+a new file, e.g.: `docs/hooks.py`, and put the following function there:
+
+```python
+import shutil
+
+def copy_readme(*args, **kwargs):
+ shutil.copy("README.md", "docs/index.md")
+```
+
+Now, register the hook in your `mkdocs.yml`:
+
+```yaml
+plugins:
+ - mkdocs-simple-hooks:
+ hooks:
+ on_pre_build: "docs.hooks:copy_readme"
+```
+
+That's all - the `copy_readme()` function will run every time, before building the documentation.
+
+
+## Disabling the plugin
+
+You can use the `enabled` option to optionally disable this plugin. A possible use case is local development where you might want faster build times. It's recommended to use this option with an environment variable together with a default fallback (introduced in `mkdocs` v1.2.1, see [docs](https://www.mkdocs.org/user-guide/configuration/#environment-variables)). Example:
+
+```yaml
+plugins:
+ - mkdocs-simple-hooks:
+ enabled: !ENV [ENABLE_MKDOCS_SIMPLE_HOOKS, True]
+ hooks:
+ on_pre_build: "docs.hooks:copy_readme"
+```
+
+Which enables you to disable the plugin locally using:
+
+```bash
+export ENABLE_MKDOCS_SIMPLE_HOOKS=false
+mkdocs serve
+```
+
+[mkdocs-plugins]: http://www.mkdocs.org/user-guide/plugins/
+[mkdocs-hooks]: https://www.mkdocs.org/user-guide/plugins/#events
+
+
+
+
+%package help
+Summary: Development documents and examples for mkdocs-simple-hooks
+Provides: python3-mkdocs-simple-hooks-doc
+%description help
+# mkdocs-simple-hooks
+
+Define your own hooks for mkdocs, without having to create a new package.
+
+## Setup
+
+Install the plugin using pip:
+
+```bash
+pip install mkdocs-simple-hooks
+```
+
+Next, add a python module to either the `docs/` directory or the root mkdocs directory. Then, add the plugin and hooks definition to your `mkdocs.yml`:
+
+```yaml
+plugins:
+ - search
+ - mkdocs-simple-hooks:
+ hooks:
+ hook-name: "your.module:hook_function"
+```
+
+> If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set.
+
+More information about plugins in the [MkDocs documentation][mkdocs-plugins].
+
+## Usage
+
+You can use this plugin to create simple hooks for `mkdocs` without having to create
+a separate plugin package.
+
+Just define a function and register it as a hook in the `mkdocs.yml`. The function shall
+have the same API as the desired hook. To see available hooks and their API, see the
+events chapter in the [mkdocs documentation][mkdocs-hooks].
+
+## Example
+
+Let's say you want to copy the `README.md` file to `docs/index.md`. To do that, create
+a new file, e.g.: `docs/hooks.py`, and put the following function there:
+
+```python
+import shutil
+
+def copy_readme(*args, **kwargs):
+ shutil.copy("README.md", "docs/index.md")
+```
+
+Now, register the hook in your `mkdocs.yml`:
+
+```yaml
+plugins:
+ - mkdocs-simple-hooks:
+ hooks:
+ on_pre_build: "docs.hooks:copy_readme"
+```
+
+That's all - the `copy_readme()` function will run every time, before building the documentation.
+
+
+## Disabling the plugin
+
+You can use the `enabled` option to optionally disable this plugin. A possible use case is local development where you might want faster build times. It's recommended to use this option with an environment variable together with a default fallback (introduced in `mkdocs` v1.2.1, see [docs](https://www.mkdocs.org/user-guide/configuration/#environment-variables)). Example:
+
+```yaml
+plugins:
+ - mkdocs-simple-hooks:
+ enabled: !ENV [ENABLE_MKDOCS_SIMPLE_HOOKS, True]
+ hooks:
+ on_pre_build: "docs.hooks:copy_readme"
+```
+
+Which enables you to disable the plugin locally using:
+
+```bash
+export ENABLE_MKDOCS_SIMPLE_HOOKS=false
+mkdocs serve
+```
+
+[mkdocs-plugins]: http://www.mkdocs.org/user-guide/plugins/
+[mkdocs-hooks]: https://www.mkdocs.org/user-guide/plugins/#events
+
+
+
+
+%prep
+%autosetup -n mkdocs-simple-hooks-0.1.5
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-mkdocs-simple-hooks -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.5-1
+- Package Spec generated