Skip to content

Conversation

@schivmeister
Copy link
Contributor

@schivmeister schivmeister commented Nov 11, 2025

The AsciiDoc template generation system mirrors the HTML system. We reuse existing infrastructure, using a refactored data source builder and validation similar to the HTML templates, ensuring consistency.

  • Template environment setup in dqgen/services/__init__.py
  • New AsciiDoc generator service asciidoc_generator.py
  • New AsciiDoc template generator service asciidoc_templates_generator.py
  • Refactored and renamed the data source builder to remove HTML-specifics
  • New CLI entrypoint for the new service
  • New Make target
  • New, refactored tests including for the data source builder of both types

Example run, for the OWL AP:

make generate_asciidoc_templates ap=dqgen/resources/aps/owl-core.csv
output=./output

Thanks to CursorAI & VSCode Copilot.

The AsciiDoc template generation system mirrors the HTML system. We
reuse existing infrastructure, using the same data source builder and
validation as the HTML templates, ensuring consistency.

- Template environment setup in `dqgen/services/__init__.py`
- New AsciiDoc generator service `asciidoc_generator.py`
- New AsciiDoc template generator service
  `asciidoc_templates_generator.py`
- New CLI entrypoint for the new service
- New Make target

The generator reuses `template_builder.build_html_template()` (same
parameters, different template content).

Example run, for the OWL AP:

```sh
make generate_asciidoc_templates ap=dqgen/resources/aps/owl-core.csv
output=./output
```

Thanks to CursorAI.
@schivmeister schivmeister self-assigned this Nov 11, 2025
@schivmeister schivmeister marked this pull request as draft November 11, 2025 18:47
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 91 to 103
def generate_asciidoc_template(processed_csv_file: pd.DataFrame, asciidoc_output_folder_path, template, file_name):
"""
Builds an AsciiDoc page and puts into a specified folder
:param file_name:
:param template:
:param processed_csv_file:
:param asciidoc_output_folder_path:
:return:
"""

data_source = build_datasource_for_html_template(processed_csv_file=processed_csv_file)
build_template = template.stream(data_source=data_source)
build_template.dump(asciidoc_output_folder_path + "/" + file_name)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Build data source with HTML file extensions

The AsciiDoc generator calls build_datasource_for_html_template, which always produces include paths ending in .html. However AsciiDocGenerator writes the class/property fragments with the .adoc extension. The generated main.adoc and statistics.adoc will therefore try to {% include %} .html files that do not exist, leaving the report empty. The data source needs to emit .adoc file names (or a variant of the builder that accepts the target extension) so the include paths match the files produced.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed by refactoring the datasource builder

Copy link
Contributor

@costezki costezki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is place for improvement, but we shall proceed to save time.

Base automatically changed from feature/DIF1-31_asciidoc-jinja to main November 12, 2025 09:25
The query files inserted within the AsciiDoc templates appeared to be
HTML files. Add a `file_extension` parameter to produce whatever file
extension is needed, currently either `.html` or `.adoc`. Update/add
tests accordingly so such accidents can be captured in the future.
@schivmeister schivmeister marked this pull request as ready for review November 13, 2025 17:09
@schivmeister schivmeister merged commit 785ae79 into main Nov 14, 2025
2 checks passed
@schivmeister schivmeister deleted the feature/DIF1-32_asciidoc-generation branch November 14, 2025 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants