Skip to content

Commit

Permalink
Upgrade version
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubAndrysek committed Jun 30, 2023
1 parent 6ce8ab4 commit 52ef551
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: MkDoxy build all supported Python versions
name: MkDoxy test build demos with all supported python versions

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
# You can use PyPy versions in python-version.
Expand All @@ -25,7 +24,7 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install mkdocs-material
pip install .
pip install .
sudo apt-get install doxygen
- name: Clone test repo
run: git clone https://github.com/JakubAndrysek/MkDoxy-demo.git demo
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/mkdoxy-test-repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: MkDoxy test build this doc with all supported python versions

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
# You can use PyPy versions in python-version.
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install mkdocs-material
pip install .
sudo apt-get install doxygen
- name: Build docs
run: mkdocs build --clean --verbose
83 changes: 60 additions & 23 deletions .idea/workspace.xml

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

2 changes: 1 addition & 1 deletion docs/snippets/other.md → docs/snippets/files.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Snippets - Other
# Snippets - Files

## `::: doxy.<project>.file.list`

Expand Down
6 changes: 3 additions & 3 deletions docs/snippets/namespaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
This tag generates a list of all namespaces in the project.

=== "Tag usage"
```yaml
::: doxy.animal.namespace.list
```
```yaml
::: doxy.animal.namespace.list
```

=== "Tag result"
::: doxy.animal.namespace.list
Expand Down
3 changes: 1 addition & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ theme:
- navigation.tabs
- navigation.indexes
- navigation.top
# - content.tabs.link

icon:
repo: fontawesome/brands/github
Expand Down Expand Up @@ -142,7 +141,7 @@ nav:
- "Links": "snippets/links.md"
- "Functions": "snippets/functions.md"
- "Namespaces": "snippets/namespaces.md"
- "Other": "snippets/other.md"
- "Files": "snippets/files.md"
- MkDoxy API:
- "mkdoxyApi/index.md"
- "Links": "mkdoxyApi/links.md"
Expand Down
6 changes: 1 addition & 5 deletions mkdoxy/generatorAuto.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,10 @@ def _generate_recursive_files(self, output_summary: str, node: Node, level: int,
if node.kind.is_file() or node.kind.is_dir():
output_summary += str(
' ' * int(level +2 ) +generate_link(node.name, f'{node.refid}.md', end='')
# ' ' * level + " * " + generate_link(node.name, f'{node.refid}.md')
)

if node.kind.is_file():
if config["emojis_enabled"]:
output_summary += f" [:octicons-file-code-16:]({node.refid}_source.md) \n"
else:
output_summary += f" [[source code]]({node.refid}_source.md) \n"
output_summary += f" [[source code]]({node.refid}_source.md) \n"
else:
output_summary += "\n"

Expand Down
28 changes: 7 additions & 21 deletions mkdoxy/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class MkDoxy(BasePlugin):
('ignore-errors', config_options.Type(bool, default=False)),
('save-api', config_options.Type(str, default="")),
("enabled", config_options.Type(bool, default=True)),
("emojis-enabled", config_options.Type(bool, default=False)),
)

# Config options for each project
Expand All @@ -57,27 +56,13 @@ def is_enabled(self) -> bool:
"""
return self.config.get("enabled")

def on_pre_build(self, config: base.Config):
"""! Checks if the required markdown extensions are enabled (example: pymdownx.emoji).
def on_files(self, files: files.Files, config: base.Config) -> files.Files:
"""! Called after files have been gathered by MkDocs.
@details
@param config (Config): The MkDocs config.
"""
if not self.is_enabled():
return
check_enabled_markdown_extensions(config, self.config)

def on_files(self, files: files.Files, config: base.Config) -> files.Files:
"""
Run Doxygen if needed and parse XML to basic structure.
The basic structure is parsed to recursive Nodes.
Then prepare generator for future use (GeneratorAuto, SnippetGenerator)
Generate full documentation if enabled.
Appends the generated files to the MkDocs files.
:param files: The MkDocs files.
:param config: The MkDocs config.
:return: The MkDocs files.
@param files: (Files) The files gathered by MkDocs.
@param config: (Config) The global configuration object.
@return: (Files) The files gathered by MkDocs.
"""
if not self.is_enabled():
return files
Expand Down Expand Up @@ -107,7 +92,6 @@ def tempDir(siteDir: str, tempDir:str, projectName: str) ->str:

# generate automatic documentation and append files in the list of files to be processed by mkdocs
self.defaultTemplateConfig: dict = {
"emojis_enabled": self.config.get("emojis-enabled", False),
"indent_level": 0,
}

Expand Down Expand Up @@ -217,6 +201,8 @@ def on_page_markdown(
# def on_config(self, config):
# return config
#
# def on_pre_build(self, config: base.Config):
# return
# def on_post_build(self, config):
# return
#
Expand Down
2 changes: 1 addition & 1 deletion mkdoxy/templates/member.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ implements: True
{%- endfor %}

{% if node.is_file and node.has_programlisting -%}
[Go to the source code of this file {% if config.emojis_enabled %}:octicons-file-code-16:{% endif %}]({{node.url_source}})
[Go to the source code of this file]({{node.url_source}})
{%- endif %}

{{node.brief}}
Expand Down
2 changes: 1 addition & 1 deletion mkdoxy/templates/programlisting.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ breadcrumbs: False
{{'**>**'|indent(1, true)}} [**{{child.name_long if node.is_group else child.name_short}}**]({{child.url}})
{%- endfor %}

[Go to the documentation of this file {% if config.emojis_enabled %}:material-file-document:{% endif %}]({{node.url}})
[Go to the documentation of this file]({{node.url}})

```{{ node.code_language }}
{{node.programlisting}}
Expand Down
8 changes: 4 additions & 4 deletions mkdoxy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def check_enabled_markdown_extensions(config: Config, mkdoxyConfig: Config) -> N
Checks if the required markdown extensions are enabled.
:param config: The MkDocs config.
"""
enabled_extensions = config['markdown_extensions']
if mkdoxyConfig.get("emojis-enabled", False):
if 'pymdownx.emoji' not in enabled_extensions:
log.warning("The 'pymdownx.emoji' extension is not enabled. Some emojis may not be rendered correctly. https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/#configuration")
# enabled_extensions = config['markdown_extensions']
# if mkdoxyConfig.get("emojis-enabled", False):
# if 'pymdownx.emoji' not in enabled_extensions:
# log.warning("The 'pymdownx.emoji' extension is not enabled. Some emojis may not be rendered correctly. https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/#configuration")
9 changes: 3 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
mkdocs~=1.4.3
Jinja2~=3.1.2
ruamel.yaml
mkdocs-open-in-new-tab
ruamel.yaml==0.17.32
mkdocs-open-in-new-tab~=1.0.2
pathlib~=1.0.1
mkdoxy~=1.0.6
path~=16.6.0
setuptools~=67.6.1
Markdown~=3.3.7
path~=16.6.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def requirements():
# https://pypi.org/project/mkdoxy/
setup(
name='mkdoxy',
version='1.0.6',
version='1.1.0',
description='MkDoxy → MkDocs + Doxygen = easy documentation generator with code snippets',
long_description=readme(),
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 52ef551

Please sign in to comment.