{{ software['description'] }}
+diff --git a/Makefile b/Makefile index 180fa11..1bfc066 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ install: ##### TESTS ##### .PHONY: test # run tests -test: test_pylint clean clone_awesome_selfhosted test_import_awesome_selfhosted test_process_awesome_selfhosted test_export_awesome_selfhosted test_import_shaarli test_download_video +test: test_pylint clean clone_awesome_selfhosted test_import_awesome_selfhosted test_process_awesome_selfhosted test_export_awesome_selfhosted_md test_export_awesome_selfhosted_html test_import_shaarli test_download_video .PHONY: test_pylint # run linter (non blocking) test_pylint: install @@ -41,12 +41,18 @@ test_process_awesome_selfhosted: install hecat --config tests/.hecat.awesome_lint.yml cd awesome-selfhosted-data && git --no-pager diff --color=always -.PHONY: test_export_awesome_selfhosted # test export to singlepage markdown from awesome-selfhosted-data -test_export_awesome_selfhosted: install +.PHONY: test_export_awesome_selfhosted_md # test export to singlepage markdown from awesome-selfhosted-data +test_export_awesome_selfhosted_md: install source .venv/bin/activate && \ hecat --config tests/.hecat.export_markdown_singlepage.yml && \ cd awesome-selfhosted && git --no-pager diff --color=always +.PHONY: test_export_awesome_selfhosted_html # test export to singlepage HTML from awesome-selfhosted-data +test_export_awesome_selfhosted_html: install + mkdir -p awesome-selfhosted-html + source .venv/bin/activate && \ + hecat --config tests/.hecat.export_html_singlepage.yml + .PHONY: test_import_shaarli # test import from shaarli JSON test_import_shaarli: install source .venv/bin/activate && \ diff --git a/hecat/exporters/__init__.py b/hecat/exporters/__init__.py index 96b895b..74bd564 100644 --- a/hecat/exporters/__init__.py +++ b/hecat/exporters/__init__.py @@ -1,2 +1,3 @@ """exporters""" from .markdown_singlepage import render_markdown_singlepage +from .html_singlepage import render_html_singlepage diff --git a/hecat/exporters/html_singlepage.py b/hecat/exporters/html_singlepage.py new file mode 100644 index 0000000..ea80d4e --- /dev/null +++ b/hecat/exporters/html_singlepage.py @@ -0,0 +1,444 @@ +"""export data to single HTML document +$ git clone https://github.com/awesome-selfhosted/awesome-selfhosted-data +$ $EDITOR .hecat.yml +$ hecat + +# .hecat.yml +steps: + - name: export YAML data to single-page HTML + module: exporters/html_singlepage + module_options: + source_directory: awesome-selfhosted-data + output_directory: awesome-selfhosted-html + output_file: index.html # optional, default index.html + authors_file: AUTHORS.md # optional, default no authors file + exclude_licenses: # optional, default [] + - 'CC-BY-NC-4.0' + - '⊘ Proprietary' + - 'SSPL-1.0' + +Output directory structure: +└── index.html +└── TODO + +The source YAML directory structure is documented in markdown_singlepage.py. +Files containing software/platforms data must be formatted as documented in markdown_singlepage.py. +The authors_file, if set, will be generated from the `git shortlog` of your source directory. +""" + +import logging +import ruamel.yaml +from ..utils import load_yaml_data +from jinja2 import Template + +yaml = ruamel.yaml.YAML(typ='safe') +yaml.indent(sequence=4, offset=2) + +HTML_HEAD=""" + + + +
+{{ software['description'] }}
+