diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8f9f10c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.dclg linguist-language=XML diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cff7a00..a1badba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,3 +89,20 @@ For maintainers preparing a release: (syncs version across artifacts, regenerates Appendix A, writes DOCX exports, and prepends a section to `CHANGELOG.md`; optional `--reference-input reference/input`) - Make any manual changes needed (e.g. ToC regeneration on DOCX file, export to PDF etc.) 3. **Commit & tag** — once committed to `main`, create and push the tag. + +## Working with DocLang files + +To streamline working with the recommended file extensions, custom mappings can be provided to both the operating system and the IDE. + +For example, in IDEs based on VS Code, you can add the following to your `settings.json` (or accordingly extend the `"files.associations"` key if already present): + +```json +{ + "files.associations": { + "*.dclg": "xml" + } +} +``` + +On the OS level, e.g. on Mac, you can choose which app opens a certain file type (e.g. `.dclg` files) as described +[here](https://support.apple.com/guide/mac-help/choose-an-app-to-open-a-file-on-mac-mh35597/mac). diff --git a/README.md b/README.md index 79e7b70..ac8c772 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ pip install doclang You can then validate a DocLang document as follows: ```bash -doclang validate -n my_document.dclg.xml +doclang validate -n my_document.dclg ``` For more details, see the [doclang/README.md](https://github.com/doclang-project/doclang/blob/main/doclang/README.md). diff --git a/doclang/README.md b/doclang/README.md index ff24ad4..baa318c 100644 --- a/doclang/README.md +++ b/doclang/README.md @@ -13,26 +13,26 @@ pip install doclang ### Basic CLI Usage ```bash -doclang validate my_document.dclg.xml +doclang validate my_document.dclg ``` ### More CLI Usage Scenarios ```bash ## Inject DocLang namespace if document doesn't declare it: -doclang validate my_document.dclg.xml --allow-empty-namespace +doclang validate my_document.dclg --allow-empty-namespace # XSD validation only -doclang validate my_document.dclg.xml --xsd-only +doclang validate my_document.dclg --xsd-only # Schematron validation only -doclang validate my_document.dclg.xml --schematron-only +doclang validate my_document.dclg --schematron-only # JSON output -doclang validate my_document.dclg.xml --format json +doclang validate my_document.dclg --format json # Quiet mode (exit code only) -doclang validate my_document.dclg.xml --quiet +doclang validate my_document.dclg --quiet # Show help doclang --help @@ -44,7 +44,7 @@ doclang --help from doclang import validate, ValidationError try: - validate("my_document.dclg.xml") + validate("my_document.dclg") print("Validation OK (no exception)") except ValidationError as exc: print(exc) # human-readable summary @@ -83,7 +83,7 @@ In VS Code you can use [Red Hat's XML extension](https://open-vsx.org/vscode/ite ```xml "xml.fileAssociations": [ { - "pattern": "**/*.dclg.xml", + "pattern": "**/*.dclg", "systemId": "file:///absolute/path/to/doclang.xsd", } ], diff --git a/reference/input/examples/doclang.dclg.xml b/reference/input/examples/doclang.dclg similarity index 100% rename from reference/input/examples/doclang.dclg.xml rename to reference/input/examples/doclang.dclg diff --git a/reference/input/examples/page_break.dclg.xml b/reference/input/examples/page_break.dclg similarity index 100% rename from reference/input/examples/page_break.dclg.xml rename to reference/input/examples/page_break.dclg diff --git a/spec.md b/spec.md index 4ecfabf..b2721e2 100644 --- a/spec.md +++ b/spec.md @@ -246,6 +246,8 @@ The XSD schema itself may additionally capture a patch version and internally de ## Language Specification +DocLang markup is encoded as XML. Recommended file extension: **`.dclg`**. + The individual DocLang elements and attributes, as well as DocLang's contextual rules are specified in [Reference](#reference). The DocLang archive format is defined in [DocLang Archive Format](#doclang-archive-format). @@ -3047,7 +3049,7 @@ None (empty element). ### DocLang Archive Format -A **DocLang archive** is a [ZIP](https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.10.TXT) file using the [Open Packaging Conventions (OPC)](https://www.ecma-international.org/publications-and-standards/standards/ecma-376/) container model. Recommended extension: **`.dclg`**. +A **DocLang archive** is a [ZIP](https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.10.TXT) file using the [Open Packaging Conventions (OPC)](https://www.ecma-international.org/publications-and-standards/standards/ecma-376/) container model. Recommended extension: **`.dclx`**. An archive is a **package** of **parts** (files in the ZIP). Each part has a path (e.g. `/document.xml`) and a content type declared in `[Content_Types].xml`. The package root relationship file `_rels/.rels` identifies the main DocLang document part. diff --git a/tests/data/invalid/nok_br_element.dclg.xml b/tests/data/invalid/nok_br_element.dclg similarity index 100% rename from tests/data/invalid/nok_br_element.dclg.xml rename to tests/data/invalid/nok_br_element.dclg diff --git a/tests/data/invalid/nok_caption_in_body.dclg.xml b/tests/data/invalid/nok_caption_in_body.dclg similarity index 100% rename from tests/data/invalid/nok_caption_in_body.dclg.xml rename to tests/data/invalid/nok_caption_in_body.dclg diff --git a/tests/data/invalid/nok_caption_in_doclang.dclg.xml b/tests/data/invalid/nok_caption_in_doclang.dclg similarity index 100% rename from tests/data/invalid/nok_caption_in_doclang.dclg.xml rename to tests/data/invalid/nok_caption_in_doclang.dclg diff --git a/tests/data/invalid/nok_code_class_attribute.dclg.xml b/tests/data/invalid/nok_code_class_attribute.dclg similarity index 100% rename from tests/data/invalid/nok_code_class_attribute.dclg.xml rename to tests/data/invalid/nok_code_class_attribute.dclg diff --git a/tests/data/invalid/nok_custom_raw_text_content.dclg.xml b/tests/data/invalid/nok_custom_raw_text_content.dclg similarity index 100% rename from tests/data/invalid/nok_custom_raw_text_content.dclg.xml rename to tests/data/invalid/nok_custom_raw_text_content.dclg diff --git a/tests/data/invalid/nok_default_resolution_negative_width.dclg.xml b/tests/data/invalid/nok_default_resolution_negative_width.dclg similarity index 100% rename from tests/data/invalid/nok_default_resolution_negative_width.dclg.xml rename to tests/data/invalid/nok_default_resolution_negative_width.dclg diff --git a/tests/data/invalid/nok_field_heading_level_non_numeric.dclg.xml b/tests/data/invalid/nok_field_heading_level_non_numeric.dclg similarity index 100% rename from tests/data/invalid/nok_field_heading_level_non_numeric.dclg.xml rename to tests/data/invalid/nok_field_heading_level_non_numeric.dclg diff --git a/tests/data/invalid/nok_field_heading_level_zero.dclg.xml b/tests/data/invalid/nok_field_heading_level_zero.dclg similarity index 100% rename from tests/data/invalid/nok_field_heading_level_zero.dclg.xml rename to tests/data/invalid/nok_field_heading_level_zero.dclg diff --git a/tests/data/invalid/nok_field_item_two_own_keys.dclg.xml b/tests/data/invalid/nok_field_item_two_own_keys.dclg similarity index 100% rename from tests/data/invalid/nok_field_item_two_own_keys.dclg.xml rename to tests/data/invalid/nok_field_item_two_own_keys.dclg diff --git a/tests/data/invalid/nok_heading_level_non_numeric.dclg.xml b/tests/data/invalid/nok_heading_level_non_numeric.dclg similarity index 100% rename from tests/data/invalid/nok_heading_level_non_numeric.dclg.xml rename to tests/data/invalid/nok_heading_level_non_numeric.dclg diff --git a/tests/data/invalid/nok_heading_level_zero.dclg.xml b/tests/data/invalid/nok_heading_level_zero.dclg similarity index 100% rename from tests/data/invalid/nok_heading_level_zero.dclg.xml rename to tests/data/invalid/nok_heading_level_zero.dclg diff --git a/tests/data/invalid/nok_href_in_body.dclg.xml b/tests/data/invalid/nok_href_in_body.dclg similarity index 100% rename from tests/data/invalid/nok_href_in_body.dclg.xml rename to tests/data/invalid/nok_href_in_body.dclg diff --git a/tests/data/invalid/nok_href_missing_uri.dclg.xml b/tests/data/invalid/nok_href_missing_uri.dclg similarity index 100% rename from tests/data/invalid/nok_href_missing_uri.dclg.xml rename to tests/data/invalid/nok_href_missing_uri.dclg diff --git a/tests/data/invalid/nok_href_text_content.dclg.xml b/tests/data/invalid/nok_href_text_content.dclg similarity index 100% rename from tests/data/invalid/nok_href_text_content.dclg.xml rename to tests/data/invalid/nok_href_text_content.dclg diff --git a/tests/data/invalid/nok_key_outside_field_item.dclg.xml b/tests/data/invalid/nok_key_outside_field_item.dclg similarity index 100% rename from tests/data/invalid/nok_key_outside_field_item.dclg.xml rename to tests/data/invalid/nok_key_outside_field_item.dclg diff --git a/tests/data/invalid/nok_layer_after_location.dclg.xml b/tests/data/invalid/nok_layer_after_location.dclg similarity index 100% rename from tests/data/invalid/nok_layer_after_location.dclg.xml rename to tests/data/invalid/nok_layer_after_location.dclg diff --git a/tests/data/invalid/nok_layer_in_body.dclg.xml b/tests/data/invalid/nok_layer_in_body.dclg similarity index 100% rename from tests/data/invalid/nok_layer_in_body.dclg.xml rename to tests/data/invalid/nok_layer_in_body.dclg diff --git a/tests/data/invalid/nok_layer_in_doclang.dclg.xml b/tests/data/invalid/nok_layer_in_doclang.dclg similarity index 100% rename from tests/data/invalid/nok_layer_in_doclang.dclg.xml rename to tests/data/invalid/nok_layer_in_doclang.dclg diff --git a/tests/data/invalid/nok_layer_invalid_value.dclg.xml b/tests/data/invalid/nok_layer_invalid_value.dclg similarity index 100% rename from tests/data/invalid/nok_layer_invalid_value.dclg.xml rename to tests/data/invalid/nok_layer_invalid_value.dclg diff --git a/tests/data/invalid/nok_ldiv_invalid_scope.dclg.xml b/tests/data/invalid/nok_ldiv_invalid_scope.dclg similarity index 100% rename from tests/data/invalid/nok_ldiv_invalid_scope.dclg.xml rename to tests/data/invalid/nok_ldiv_invalid_scope.dclg diff --git a/tests/data/invalid/nok_list_out_of_item.dclg.xml b/tests/data/invalid/nok_list_out_of_item.dclg similarity index 100% rename from tests/data/invalid/nok_list_out_of_item.dclg.xml rename to tests/data/invalid/nok_list_out_of_item.dclg diff --git a/tests/data/invalid/nok_list_vtext_misplaced_ch.dclg.xml b/tests/data/invalid/nok_list_vtext_misplaced_ch.dclg similarity index 100% rename from tests/data/invalid/nok_list_vtext_misplaced_ch.dclg.xml rename to tests/data/invalid/nok_list_vtext_misplaced_ch.dclg diff --git a/tests/data/invalid/nok_list_wrapped_after.dclg.xml b/tests/data/invalid/nok_list_wrapped_after.dclg similarity index 100% rename from tests/data/invalid/nok_list_wrapped_after.dclg.xml rename to tests/data/invalid/nok_list_wrapped_after.dclg diff --git a/tests/data/invalid/nok_list_wrong_ch_order.dclg.xml b/tests/data/invalid/nok_list_wrong_ch_order.dclg similarity index 100% rename from tests/data/invalid/nok_list_wrong_ch_order.dclg.xml rename to tests/data/invalid/nok_list_wrong_ch_order.dclg diff --git a/tests/data/invalid/nok_location_count_five.dclg.xml b/tests/data/invalid/nok_location_count_five.dclg similarity index 100% rename from tests/data/invalid/nok_location_count_five.dclg.xml rename to tests/data/invalid/nok_location_count_five.dclg diff --git a/tests/data/invalid/nok_location_count_two.dclg.xml b/tests/data/invalid/nok_location_count_two.dclg similarity index 100% rename from tests/data/invalid/nok_location_count_two.dclg.xml rename to tests/data/invalid/nok_location_count_two.dclg diff --git a/tests/data/invalid/nok_location_normalized_rejects_raw_asc.dclg.xml b/tests/data/invalid/nok_location_normalized_rejects_raw_asc.dclg similarity index 100% rename from tests/data/invalid/nok_location_normalized_rejects_raw_asc.dclg.xml rename to tests/data/invalid/nok_location_normalized_rejects_raw_asc.dclg diff --git a/tests/data/invalid/nok_location_order_x_desc.dclg.xml b/tests/data/invalid/nok_location_order_x_desc.dclg similarity index 100% rename from tests/data/invalid/nok_location_order_x_desc.dclg.xml rename to tests/data/invalid/nok_location_order_x_desc.dclg diff --git a/tests/data/invalid/nok_location_order_y_desc.dclg.xml b/tests/data/invalid/nok_location_order_y_desc.dclg similarity index 100% rename from tests/data/invalid/nok_location_order_y_desc.dclg.xml rename to tests/data/invalid/nok_location_order_y_desc.dclg diff --git a/tests/data/invalid/nok_location_value_eq_default_width.dclg.xml b/tests/data/invalid/nok_location_value_eq_default_width.dclg similarity index 100% rename from tests/data/invalid/nok_location_value_eq_default_width.dclg.xml rename to tests/data/invalid/nok_location_value_eq_default_width.dclg diff --git a/tests/data/invalid/nok_location_value_eq_token_resolution.dclg.xml b/tests/data/invalid/nok_location_value_eq_token_resolution.dclg similarity index 100% rename from tests/data/invalid/nok_location_value_eq_token_resolution.dclg.xml rename to tests/data/invalid/nok_location_value_eq_token_resolution.dclg diff --git a/tests/data/invalid/nok_misplaced_content.dclg.xml b/tests/data/invalid/nok_misplaced_content.dclg similarity index 100% rename from tests/data/invalid/nok_misplaced_content.dclg.xml rename to tests/data/invalid/nok_misplaced_content.dclg diff --git a/tests/data/invalid/nok_misplaced_value.dclg.xml b/tests/data/invalid/nok_misplaced_value.dclg similarity index 100% rename from tests/data/invalid/nok_misplaced_value.dclg.xml rename to tests/data/invalid/nok_misplaced_value.dclg diff --git a/tests/data/invalid/nok_old_version.dclg.xml b/tests/data/invalid/nok_old_version.dclg similarity index 100% rename from tests/data/invalid/nok_old_version.dclg.xml rename to tests/data/invalid/nok_old_version.dclg diff --git a/tests/data/invalid/nok_page_break_nested_in_text.dclg.xml b/tests/data/invalid/nok_page_break_nested_in_text.dclg similarity index 100% rename from tests/data/invalid/nok_page_break_nested_in_text.dclg.xml rename to tests/data/invalid/nok_page_break_nested_in_text.dclg diff --git a/tests/data/invalid/nok_picture_chart_src_before_tabular.dclg.xml b/tests/data/invalid/nok_picture_chart_src_before_tabular.dclg similarity index 100% rename from tests/data/invalid/nok_picture_chart_src_before_tabular.dclg.xml rename to tests/data/invalid/nok_picture_chart_src_before_tabular.dclg diff --git a/tests/data/invalid/nok_picture_invalid_class.dclg.xml b/tests/data/invalid/nok_picture_invalid_class.dclg similarity index 100% rename from tests/data/invalid/nok_picture_invalid_class.dclg.xml rename to tests/data/invalid/nok_picture_invalid_class.dclg diff --git a/tests/data/invalid/nok_picture_undefined_with_tabular.dclg.xml b/tests/data/invalid/nok_picture_undefined_with_tabular.dclg similarity index 100% rename from tests/data/invalid/nok_picture_undefined_with_tabular.dclg.xml rename to tests/data/invalid/nok_picture_undefined_with_tabular.dclg diff --git a/tests/data/invalid/nok_table_class_attribute.dclg.xml b/tests/data/invalid/nok_table_class_attribute.dclg similarity index 100% rename from tests/data/invalid/nok_table_class_attribute.dclg.xml rename to tests/data/invalid/nok_table_class_attribute.dclg diff --git a/tests/data/invalid/nok_table_invalid_class.dclg.xml b/tests/data/invalid/nok_table_invalid_class.dclg similarity index 100% rename from tests/data/invalid/nok_table_invalid_class.dclg.xml rename to tests/data/invalid/nok_table_invalid_class.dclg diff --git a/tests/data/invalid/nok_table_out_of_cell.dclg.xml b/tests/data/invalid/nok_table_out_of_cell.dclg similarity index 100% rename from tests/data/invalid/nok_table_out_of_cell.dclg.xml rename to tests/data/invalid/nok_table_out_of_cell.dclg diff --git a/tests/data/invalid/nok_table_text_misplaced_ch.dclg.xml b/tests/data/invalid/nok_table_text_misplaced_ch.dclg similarity index 100% rename from tests/data/invalid/nok_table_text_misplaced_ch.dclg.xml rename to tests/data/invalid/nok_table_text_misplaced_ch.dclg diff --git a/tests/data/invalid/nok_table_unequal_columns.dclg.xml b/tests/data/invalid/nok_table_unequal_columns.dclg similarity index 100% rename from tests/data/invalid/nok_table_unequal_columns.dclg.xml rename to tests/data/invalid/nok_table_unequal_columns.dclg diff --git a/tests/data/invalid/nok_table_vtext_misplaced_ch.dclg.xml b/tests/data/invalid/nok_table_vtext_misplaced_ch.dclg similarity index 100% rename from tests/data/invalid/nok_table_vtext_misplaced_ch.dclg.xml rename to tests/data/invalid/nok_table_vtext_misplaced_ch.dclg diff --git a/tests/data/invalid/nok_text_misplaced_ch.dclg.xml b/tests/data/invalid/nok_text_misplaced_ch.dclg similarity index 100% rename from tests/data/invalid/nok_text_misplaced_ch.dclg.xml rename to tests/data/invalid/nok_text_misplaced_ch.dclg diff --git a/tests/data/invalid/nok_thread_in_body.dclg.xml b/tests/data/invalid/nok_thread_in_body.dclg similarity index 100% rename from tests/data/invalid/nok_thread_in_body.dclg.xml rename to tests/data/invalid/nok_thread_in_body.dclg diff --git a/tests/data/invalid/nok_thread_missing_thread_id.dclg.xml b/tests/data/invalid/nok_thread_missing_thread_id.dclg similarity index 100% rename from tests/data/invalid/nok_thread_missing_thread_id.dclg.xml rename to tests/data/invalid/nok_thread_missing_thread_id.dclg diff --git a/tests/data/invalid/nok_thread_mixed_host_types.dclg.xml b/tests/data/invalid/nok_thread_mixed_host_types.dclg similarity index 100% rename from tests/data/invalid/nok_thread_mixed_host_types.dclg.xml rename to tests/data/invalid/nok_thread_mixed_host_types.dclg diff --git a/tests/data/invalid/nok_xref_and_href.dclg.xml b/tests/data/invalid/nok_xref_and_href.dclg similarity index 100% rename from tests/data/invalid/nok_xref_and_href.dclg.xml rename to tests/data/invalid/nok_xref_and_href.dclg diff --git a/tests/data/invalid/nok_xref_undefined_thread.dclg.xml b/tests/data/invalid/nok_xref_undefined_thread.dclg similarity index 100% rename from tests/data/invalid/nok_xref_undefined_thread.dclg.xml rename to tests/data/invalid/nok_xref_undefined_thread.dclg diff --git a/tests/data/invalid/nok_xsd_and_schematron.dclg.xml b/tests/data/invalid/nok_xsd_and_schematron.dclg similarity index 100% rename from tests/data/invalid/nok_xsd_and_schematron.dclg.xml rename to tests/data/invalid/nok_xsd_and_schematron.dclg diff --git a/tests/data/valid/doclang_example.dclg.xml b/tests/data/valid/doclang_example.dclg similarity index 100% rename from tests/data/valid/doclang_example.dclg.xml rename to tests/data/valid/doclang_example.dclg diff --git a/tests/data/valid/ok_caption_property_head.dclg.xml b/tests/data/valid/ok_caption_property_head.dclg similarity index 100% rename from tests/data/valid/ok_caption_property_head.dclg.xml rename to tests/data/valid/ok_caption_property_head.dclg diff --git a/tests/data/valid/ok_caption_semantic.dclg.xml b/tests/data/valid/ok_caption_semantic.dclg similarity index 100% rename from tests/data/valid/ok_caption_semantic.dclg.xml rename to tests/data/valid/ok_caption_semantic.dclg diff --git a/tests/data/valid/ok_comprehensive.dclg.xml b/tests/data/valid/ok_comprehensive.dclg similarity index 100% rename from tests/data/valid/ok_comprehensive.dclg.xml rename to tests/data/valid/ok_comprehensive.dclg diff --git a/tests/data/valid/ok_content_in_virtual_text.dclg.xml b/tests/data/valid/ok_content_in_virtual_text.dclg similarity index 100% rename from tests/data/valid/ok_content_in_virtual_text.dclg.xml rename to tests/data/valid/ok_content_in_virtual_text.dclg diff --git a/tests/data/valid/ok_default_resolution_in_head.dclg.xml b/tests/data/valid/ok_default_resolution_in_head.dclg similarity index 100% rename from tests/data/valid/ok_default_resolution_in_head.dclg.xml rename to tests/data/valid/ok_default_resolution_in_head.dclg diff --git a/tests/data/valid/ok_default_resolution_width_only.dclg.xml b/tests/data/valid/ok_default_resolution_width_only.dclg similarity index 100% rename from tests/data/valid/ok_default_resolution_width_only.dclg.xml rename to tests/data/valid/ok_default_resolution_width_only.dclg diff --git a/tests/data/valid/ok_field_item_nested_descendant_key_scope.dclg.xml b/tests/data/valid/ok_field_item_nested_descendant_key_scope.dclg similarity index 100% rename from tests/data/valid/ok_field_item_nested_descendant_key_scope.dclg.xml rename to tests/data/valid/ok_field_item_nested_descendant_key_scope.dclg diff --git a/tests/data/valid/ok_href.dclg.xml b/tests/data/valid/ok_href.dclg similarity index 100% rename from tests/data/valid/ok_href.dclg.xml rename to tests/data/valid/ok_href.dclg diff --git a/tests/data/valid/ok_index.dclg.xml b/tests/data/valid/ok_index.dclg similarity index 100% rename from tests/data/valid/ok_index.dclg.xml rename to tests/data/valid/ok_index.dclg diff --git a/tests/data/valid/ok_label_element_head.dclg.xml b/tests/data/valid/ok_label_element_head.dclg similarity index 100% rename from tests/data/valid/ok_label_element_head.dclg.xml rename to tests/data/valid/ok_label_element_head.dclg diff --git a/tests/data/valid/ok_layer.dclg.xml b/tests/data/valid/ok_layer.dclg similarity index 100% rename from tests/data/valid/ok_layer.dclg.xml rename to tests/data/valid/ok_layer.dclg diff --git a/tests/data/valid/ok_layer_default.dclg.xml b/tests/data/valid/ok_layer_default.dclg similarity index 100% rename from tests/data/valid/ok_layer_default.dclg.xml rename to tests/data/valid/ok_layer_default.dclg diff --git a/tests/data/valid/ok_layer_element_head_order.dclg.xml b/tests/data/valid/ok_layer_element_head_order.dclg similarity index 100% rename from tests/data/valid/ok_layer_element_head_order.dclg.xml rename to tests/data/valid/ok_layer_element_head_order.dclg diff --git a/tests/data/valid/ok_list_raw_before.dclg.xml b/tests/data/valid/ok_list_raw_before.dclg similarity index 100% rename from tests/data/valid/ok_list_raw_before.dclg.xml rename to tests/data/valid/ok_list_raw_before.dclg diff --git a/tests/data/valid/ok_list_raw_none.dclg.xml b/tests/data/valid/ok_list_raw_none.dclg similarity index 100% rename from tests/data/valid/ok_list_raw_none.dclg.xml rename to tests/data/valid/ok_list_raw_none.dclg diff --git a/tests/data/valid/ok_list_with_unwrapped_text.dclg.xml b/tests/data/valid/ok_list_with_unwrapped_text.dclg similarity index 100% rename from tests/data/valid/ok_list_with_unwrapped_text.dclg.xml rename to tests/data/valid/ok_list_with_unwrapped_text.dclg diff --git a/tests/data/valid/ok_list_wrapped_before.dclg.xml b/tests/data/valid/ok_list_wrapped_before.dclg similarity index 100% rename from tests/data/valid/ok_list_wrapped_before.dclg.xml rename to tests/data/valid/ok_list_wrapped_before.dclg diff --git a/tests/data/valid/ok_list_wrapped_none.dclg.xml b/tests/data/valid/ok_list_wrapped_none.dclg similarity index 100% rename from tests/data/valid/ok_list_wrapped_none.dclg.xml rename to tests/data/valid/ok_list_wrapped_none.dclg diff --git a/tests/data/valid/ok_location_axis_limits.dclg.xml b/tests/data/valid/ok_location_axis_limits.dclg similarity index 100% rename from tests/data/valid/ok_location_axis_limits.dclg.xml rename to tests/data/valid/ok_location_axis_limits.dclg diff --git a/tests/data/valid/ok_location_equal_bounds.dclg.xml b/tests/data/valid/ok_location_equal_bounds.dclg similarity index 100% rename from tests/data/valid/ok_location_equal_bounds.dclg.xml rename to tests/data/valid/ok_location_equal_bounds.dclg diff --git a/tests/data/valid/ok_location_normalized_allows_raw_desc.dclg.xml b/tests/data/valid/ok_location_normalized_allows_raw_desc.dclg similarity index 100% rename from tests/data/valid/ok_location_normalized_allows_raw_desc.dclg.xml rename to tests/data/valid/ok_location_normalized_allows_raw_desc.dclg diff --git a/tests/data/valid/ok_marker_location_head.dclg.xml b/tests/data/valid/ok_marker_location_head.dclg similarity index 100% rename from tests/data/valid/ok_marker_location_head.dclg.xml rename to tests/data/valid/ok_marker_location_head.dclg diff --git a/tests/data/valid/ok_namespaced_and_versioned.dclg.xml b/tests/data/valid/ok_namespaced_and_versioned.dclg similarity index 100% rename from tests/data/valid/ok_namespaced_and_versioned.dclg.xml rename to tests/data/valid/ok_namespaced_and_versioned.dclg diff --git a/tests/data/valid/ok_no_namespace.dclg.xml b/tests/data/valid/ok_no_namespace.dclg similarity index 100% rename from tests/data/valid/ok_no_namespace.dclg.xml rename to tests/data/valid/ok_no_namespace.dclg diff --git a/tests/data/valid/ok_page_break_top_level.dclg.xml b/tests/data/valid/ok_page_break_top_level.dclg similarity index 100% rename from tests/data/valid/ok_page_break_top_level.dclg.xml rename to tests/data/valid/ok_page_break_top_level.dclg diff --git a/tests/data/valid/ok_picture_chart.dclg.xml b/tests/data/valid/ok_picture_chart.dclg similarity index 100% rename from tests/data/valid/ok_picture_chart.dclg.xml rename to tests/data/valid/ok_picture_chart.dclg diff --git a/tests/data/valid/ok_picture_chemistry_structure.dclg.xml b/tests/data/valid/ok_picture_chemistry_structure.dclg similarity index 100% rename from tests/data/valid/ok_picture_chemistry_structure.dclg.xml rename to tests/data/valid/ok_picture_chemistry_structure.dclg diff --git a/tests/data/valid/ok_picture_src_data_uri.dclg.xml b/tests/data/valid/ok_picture_src_data_uri.dclg similarity index 100% rename from tests/data/valid/ok_picture_src_data_uri.dclg.xml rename to tests/data/valid/ok_picture_src_data_uri.dclg diff --git a/tests/data/valid/ok_picture_with_body.dclg.xml b/tests/data/valid/ok_picture_with_body.dclg similarity index 100% rename from tests/data/valid/ok_picture_with_body.dclg.xml rename to tests/data/valid/ok_picture_with_body.dclg diff --git a/tests/data/valid/ok_picture_with_subpictures.dclg.xml b/tests/data/valid/ok_picture_with_subpictures.dclg similarity index 100% rename from tests/data/valid/ok_picture_with_subpictures.dclg.xml rename to tests/data/valid/ok_picture_with_subpictures.dclg diff --git a/tests/data/valid/ok_picture_with_text.dclg.xml b/tests/data/valid/ok_picture_with_text.dclg similarity index 100% rename from tests/data/valid/ok_picture_with_text.dclg.xml rename to tests/data/valid/ok_picture_with_text.dclg diff --git a/tests/data/valid/ok_table_class_data.dclg.xml b/tests/data/valid/ok_table_class_data.dclg similarity index 100% rename from tests/data/valid/ok_table_class_data.dclg.xml rename to tests/data/valid/ok_table_class_data.dclg diff --git a/tests/data/valid/ok_table_raw_before.dclg.xml b/tests/data/valid/ok_table_raw_before.dclg similarity index 100% rename from tests/data/valid/ok_table_raw_before.dclg.xml rename to tests/data/valid/ok_table_raw_before.dclg diff --git a/tests/data/valid/ok_table_raw_none.dclg.xml b/tests/data/valid/ok_table_raw_none.dclg similarity index 100% rename from tests/data/valid/ok_table_raw_none.dclg.xml rename to tests/data/valid/ok_table_raw_none.dclg diff --git a/tests/data/valid/ok_table_rectangular.dclg.xml b/tests/data/valid/ok_table_rectangular.dclg similarity index 100% rename from tests/data/valid/ok_table_rectangular.dclg.xml rename to tests/data/valid/ok_table_rectangular.dclg diff --git a/tests/data/valid/ok_table_wrapped_before.dclg.xml b/tests/data/valid/ok_table_wrapped_before.dclg similarity index 100% rename from tests/data/valid/ok_table_wrapped_before.dclg.xml rename to tests/data/valid/ok_table_wrapped_before.dclg diff --git a/tests/data/valid/ok_table_wrapped_none.dclg.xml b/tests/data/valid/ok_table_wrapped_none.dclg similarity index 100% rename from tests/data/valid/ok_table_wrapped_none.dclg.xml rename to tests/data/valid/ok_table_wrapped_none.dclg diff --git a/tests/data/valid/ok_thread.dclg.xml b/tests/data/valid/ok_thread.dclg similarity index 100% rename from tests/data/valid/ok_thread.dclg.xml rename to tests/data/valid/ok_thread.dclg diff --git a/tests/data/valid/ok_thread_unused.dclg.xml b/tests/data/valid/ok_thread_unused.dclg similarity index 100% rename from tests/data/valid/ok_thread_unused.dclg.xml rename to tests/data/valid/ok_thread_unused.dclg diff --git a/tests/data/valid/ok_xref.dclg.xml b/tests/data/valid/ok_xref.dclg similarity index 100% rename from tests/data/valid/ok_xref.dclg.xml rename to tests/data/valid/ok_xref.dclg diff --git a/tests/test_cli.py b/tests/test_cli.py index 10d7a45..30613c0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -32,13 +32,13 @@ def test_cli_version_matches_installed_metadata(): def test_validate_valid_document(): """Test validating a valid document.""" - xml_file = Path("tests/data/valid/ok_comprehensive.dclg.xml") + xml_file = Path("tests/data/valid/ok_comprehensive.dclg") result = runner.invoke(app, ["validate", str(xml_file)]) assert result.exit_code == 0 def test_validate_invalid_document(): """Test validating an invalid document.""" - xml_file = Path("tests/data/invalid/nok_href_in_body.dclg.xml") + xml_file = Path("tests/data/invalid/nok_href_in_body.dclg") result = runner.invoke(app, ["validate", str(xml_file)]) assert result.exit_code == 1 diff --git a/tests/test_validation.py b/tests/test_validation.py index 815d146..b39d43a 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -19,13 +19,12 @@ # Collect test files -valid_files = list(VALID_DIR.glob("*.dclg.xml")) if VALID_DIR.exists() else [] -invalid_files = list(INVALID_DIR.glob("*.dclg.xml")) if INVALID_DIR.exists() else [] +valid_files = list(VALID_DIR.glob("*.dclg")) if VALID_DIR.exists() else [] +invalid_files = list(INVALID_DIR.glob("*.dclg")) if INVALID_DIR.exists() else [] def _allow_empty_namespace(xml_file: Path) -> bool: - base_name = xml_file.name.replace(".dclg.xml", "") - return base_name in ["ok_no_namespace", "doclang_example"] + return xml_file.stem in ["ok_no_namespace", "doclang_example"] @pytest.mark.parametrize("xml_file", valid_files, ids=lambda f: f.stem) @@ -51,7 +50,7 @@ def test_invalid(xml_file): def test_invalid_reports_both_xsd_and_schematron_errors(): """A document may fail both XSD and Schematron validation in a single run.""" - xml_file = INVALID_DIR / "nok_xsd_and_schematron.dclg.xml" + xml_file = INVALID_DIR / "nok_xsd_and_schematron.dclg" with pytest.raises(ValidationError) as exc_info: validate(xml_file, allow_empty_namespace=False) diff --git a/utils/generate_reference.py b/utils/generate_reference.py index 2829cdd..d0b3030 100644 --- a/utils/generate_reference.py +++ b/utils/generate_reference.py @@ -13,7 +13,7 @@ Arguments: - input_directory: Directory containing the Excel file with element definitions - (also may contain .dclg.xml and .png files for examples) + (also may contain .dclg and .png files for examples) """ import os @@ -242,7 +242,7 @@ def load_example_for_element(element_name, input_dir, spec_path): # Look for files in INPUT_DIR/examples/ examples_dir = Path(input_dir) / "examples" - xml_file = examples_dir / f"{clean_name}.dclg.xml" + xml_file = examples_dir / f"{clean_name}.dclg" xml_content = None image_path = None diff --git a/utils/pack-archive.sh b/utils/pack-archive.sh index 859cb03..07e45f8 100755 --- a/utils/pack-archive.sh +++ b/utils/pack-archive.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Pack a DocLang archive directory into a .dclg OPC ZIP file. +# Pack a DocLang archive directory into a .dclx OPC ZIP file. # Usage: ./utils/pack-archive.sh [output-file] set -euo pipefail @@ -11,7 +11,7 @@ fi SRC=$(cd "$1" && pwd) NAME=$(basename "$SRC") -OUT=${2:-"${NAME}.dclg"} +OUT=${2:-"${NAME}.dclx"} if [[ ! -f "$SRC/document.xml" ]]; then echo "Error: $SRC/document.xml not found" >&2