Skip to content

Commit c83d97b

Browse files
coolharsh55bact
andcommitted
HTML outputs use DPV_VERSION not hardcoded version
closes w3c#273 Squashed commit of the following: commit b42c00b1f1c2d7f1f140a164319954f84a0388b7 Author: Harshvardhan Pandit <me@harshp.com> Date: Mon Apr 7 05:53:25 2025 +0100 300.py common HTML params dict avoids repeating the same params in jinja2 template rendering calls, and reduces chance of missing some params commit 0db3dcbf1feb7612ec86475bdf17d53721712ecd Author: Arthit Suriyawongkul <arthit@gmail.com> Date: Thu Mar 27 20:08:51 2025 +0000 Add DPV_VERSION to template argument Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com> commit 0a37ce99e390fc1be78106928ea897b50e05bdf4 Author: Arthit Suriyawongkul <arthit@gmail.com> Date: Thu Mar 27 18:50:01 2025 +0000 Fix "2.1-dev" URL issues Use {{DPV_VERSION}} in URL, instead of a fixed version Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com> Co-authored-by: Arthit Suriyawongkul <arthit@gmail.com>
1 parent 758ac0b commit c83d97b

File tree

52 files changed

+67
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+67
-63
lines changed

code/300_generate_HTML.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
pyg_lexer = get_lexer_by_name("turtle", stripall=True)
3737
pyg_formatter = HtmlFormatter(cssclass="source", noclasses=True)
3838

39+
_PARAMS_JINJA2_HTML = {
40+
'RDF_VOCABS': RDF_VOCABS,
41+
'DPV_VERSION': DPV_VERSION,
42+
'DPV_PREVIOUS_VERSION': DPV_PREVIOUS_VERSION,
43+
'DOCUMENT_STATUS': DOCUMENT_STATUS,
44+
}
45+
3946
# == DATA class ==
4047

4148
class DATA(object):
@@ -819,11 +826,8 @@ def _write_template(
819826
'vocab_name': vocab,
820827
'lang': lang,
821828
'template': template_env.get_template(template),
822-
'RDF_VOCABS': RDF_VOCABS,
823-
'DPV_VERSION': DPV_VERSION,
824-
'DPV_PREVIOUS_VERSION': DPV_PREVIOUS_VERSION,
825-
'DOCUMENT_STATUS': DOCUMENT_STATUS,
826829
}
830+
params.update(_PARAMS_JINJA2_HTML)
827831
template = template_env.get_template(template)
828832
with open(f'{filepath}/{filename}-{lang}.html', 'w+') as fd:
829833
fd.write(template.render(**params))
@@ -1021,10 +1025,10 @@ def add_item_to_index(iri):
10211025
with open(filepath, 'w') as fd:
10221026
template = template_env.get_template('template_search_index.jinja2')
10231027
fd.write(template.render(
1028+
**_PARAMS_JINJA2_HTML,
10241029
data=json.dumps(index),
10251030
num_classes=len(results_classes),
1026-
num_properties=len(results_properties),
1027-
DPV_VERSION=DPV_VERSION))
1031+
num_properties=len(results_properties)))
10281032
INFO(f"wrote search index document at {filepath}")
10291033

10301034
INFO('*'*40)
@@ -1055,11 +1059,11 @@ def add_item_to_index(iri):
10551059
filepath = f"{data['output']}"
10561060
with open(filepath, 'w') as fd:
10571061
template = template_env.get_template(template)
1058-
fd.write(template.render(DPV_VERSION=DPV_VERSION, DOCUMENT_STATUS=DOCUMENT_STATUS))
1062+
fd.write(template.render(**_PARAMS_JINJA2_HTML))
10591063
INFO(f"wrote guide {doc} at {filepath}")
10601064
with open('../guides/index.html', 'w') as fd:
10611065
template = template_env.get_template('template_guides_index.jinja2')
1062-
fd.write(template.render(DPV_VERSION=DPV_VERSION, DOCUMENT_STATUS=DOCUMENT_STATUS))
1066+
fd.write(template.render(**_PARAMS_JINJA2_HTML))
10631067
INFO(f"wrote guide index at {filepath}")
10641068
INFO('*'*40)
10651069

@@ -1071,10 +1075,10 @@ def add_item_to_index(iri):
10711075
filepath = f"{data['output']}"
10721076
with open(filepath, 'w') as fd:
10731077
template = template_env.get_template(template)
1074-
fd.write(template.render(data=data))
1078+
fd.write(template.render(**_PARAMS_JINJA2_HTML, data=data))
10751079
INFO(f"wrote guide {doc} at {filepath}")
10761080
with open('../mappings/index.html', 'w') as fd:
10771081
template = template_env.get_template('template_mappings_index.jinja2')
1078-
fd.write(template.render(mappings=MAPPINGS.items()))
1082+
fd.write(template.render(**_PARAMS_JINJA2_HTML, mappings=MAPPINGS.items()))
10791083
INFO(f"wrote mapping index at {filepath}")
10801084
INFO('*'*40)

code/jinja2_resources/macro_dpv_document_family.jinja2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
{# references.json contains the title/href for documents which is automatically expanded by ReSpec ; this macro contains only the document listing and text #}
33
{% endmacro %}
44

5-
{% macro sotd(metadata=None, draft=True) %}
5+
{% macro sotd(DPV_VERSION=DPV_VERSION, metadata=None, draft=True) %}
66
<div id="dpv-document-family" class="notoc">
7-
<p><strong>DPV Specifications:</strong> The [[DPV]] is the core specification within the DPV family, with the following extensions: Personal Data [[PD]], Locations [[LOC]], Risk Management [[RISK]], Technology [[TECH]] and [[AI]], [[JUSTIFICATIONS]], [[SECTOR]] specific extensions, and [[LEGAL]] extensions modelling specific jurisdictions and regulations. A [[PRIMER]] introduces the concepts and modelling of DPV specifications, and [[GUIDES]] describe application of DPV for specific applications and use-cases. The <a href="https://w3id.org/dpv/2.1-dev/search">Search Index</a> page provides a searchable hierarchy of all concepts. The <a href="https://www.w3.org/community/dpvcg/">Data Privacy Vocabularies and Controls Community Group (DPVCG)</a> develops and manages these specifications through <a href="https://github.com/w3c/dpv/releases">GitHub</a>. For meetings, see the <a href="https://www.w3.org/groups/cg/dpvcg/calendar">DPVCG calendar</a>.</p>
7+
<p><strong>DPV Specifications:</strong> The [[DPV]] is the core specification within the DPV family, with the following extensions: Personal Data [[PD]], Locations [[LOC]], Risk Management [[RISK]], Technology [[TECH]] and [[AI]], [[JUSTIFICATIONS]], [[SECTOR]] specific extensions, and [[LEGAL]] extensions modelling specific jurisdictions and regulations. A [[PRIMER]] introduces the concepts and modelling of DPV specifications, and [[GUIDES]] describe application of DPV for specific applications and use-cases. The <a href="https://w3id.org/dpv/{{DPV_VERSION}}/search">Search Index</a> page provides a searchable hierarchy of all concepts. The <a href="https://www.w3.org/community/dpvcg/">Data Privacy Vocabularies and Controls Community Group (DPVCG)</a> develops and manages these specifications through <a href="https://github.com/w3c/dpv/releases">GitHub</a>. For meetings, see the <a href="https://www.w3.org/groups/cg/dpvcg/calendar">DPVCG calendar</a>.</p>
88
<p>To cite and understand the structure of DPV, the article "<a href="https://doi.org/10.1007/978-3-031-77847-6_10">Data Privacy Vocabulary (DPV) - Version 2.0</a>" (2024) describes the current state of DPV and extensions from version 2.0 onwards (open access version <a href="https://doi.org/10.48550/arXiv.2404.13426"><u>here</u></a>). The earlier article "<a href="https://link.springer.com/chapter/10.1007%2F978-3-030-33246-4_44"><u>Creating A Vocabulary for Data Privacy</u></a>" (2019) describes how the DPV was developed (open access versions <a href="http://hdl.handle.net/2262/91581"><u>here</u></a>, <a href="http://doras.dcu.ie/23801/"><u>here</u></a>, and <a href="https://aic.ai.wu.ac.at/~polleres/publications/pand-etal-2019ODBASE.pdf"><u>here</u></a>).
99
<p><strong>Contributing:</strong> The DPVCG welcomes participation to improve the DPV and associated resources, including expansion or refinement of concepts, requesting information and applications, and addressing open issues. <a href="https://github.com/w3c/dpv/wiki/Contribution-Guide">See contributing guide</a> for further information.</p>
1010
</div>

code/jinja2_resources/template_ai.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<section id="abstract">
128128
<p>The AI extension extends the [[[DPV]]] and its [[[TECH]]] extension to represent AI techniques, applications, risks, and mitigations. The namespace for terms in <code>ai</code> is <a href="http://www.w3id.org/dpv/ai#"><code>https://www.w3id.org/dpv/ai#</code></a>. The suggested prefix for the namespace is <code>ai</code>. The AI vocabulary and its documentation are available on <a href="https://github.com/w3c/dpv">GitHub</a>.</p>
129129
</section>
130-
{{ sotd(data[vocab_name+'-metadata']) }}
130+
{{ sotd(DPV_VERSION=DPV_VERSION, metadata=data[vocab_name+'-metadata']) }}
131131
{{ dpv_document_family(document='ai-spec') }}
132132

133133
<section id="vocab-core">

code/jinja2_resources/template_dpv.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<p>The Data Privacy Vocabulary [[DPV]] enables expressing machine-readable metadata about the use and processing of (personal or otherwise) data and technologies based on legislative requirements such as the General Data Protection Regulation [[GDPR]]. This document describes the DPV specification along with its data model. The canonical URL for DPV is <a href="https://w3id.org/dpv">https://w3id.org/dpv</a> which contains (this) specification. The namespace for DPV terms is <a href="https://w3id.org/dpv#"><code>https://w3id.org/dpv#</code></a>, the suggested prefix is <code>dpv</code>, and this document along with source and releases are available at <a href="https://github.com/w3c/dpv">https://github.com/w3c/dpv</a>. A changelog this version is provided in the <a href="#changelog">appendix</a>.</p>
9292
</section>
9393
{% endblock ABSTRACT %}
94-
{{ sotd(data[vocab_name+'-metadata']) }}
94+
{{ sotd(DPV_VERSION=DPV_VERSION, metadata=data[vocab_name+'-metadata']) }}
9595
{{ dpv_document_family(document='dpv-spec') }}
9696
{% block INTRODUCTION %}
9797
<section id="introduction">

code/jinja2_resources/template_dpv_TOM.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<section id="abstract">
9090
<p>This document provides additional details and examples for technical and organisational measures in the Data Privacy Vocabulary [[DPV]], and is a companion to the [[DPV]] specification.</p>
9191
</section>
92-
{{ sotd(data[vocab_name+'-metadata']) }}
92+
{{ sotd(DPV_VERSION=DPV_VERSION, metadata=data[vocab_name+'-metadata']) }}
9393
{{ dpv_document_family(document='dpv-spec') }}
9494
{% endblock ABSTRACT %}
9595
<section id="vocab-TOM">

code/jinja2_resources/template_dpv_context.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<p>This document provides additional details and examples for contextual concepts such as durations, frequencies, and locations used in the Data Privacy Vocabulary [[DPV]], and is a companion to the [[DPV]] specification.</p>
9191

9292
</section>
93-
{{ sotd(data[vocab_name+'-metadata']) }}
93+
{{ sotd(DPV_VERSION=DPV_VERSION, metadata=data[vocab_name+'-metadata']) }}
9494
{{ dpv_document_family(document='dpv-spec') }}
9595
{% endblock ABSTRACT %}
9696
<section id="vocab-context"><span id="vocab-rights"></span>

code/jinja2_resources/template_dpv_entities.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<p>This document provides additional details and examples for entity concepts in the Data Privacy Vocabulary [[DPV]], and is a companion to the [[DPV]] specification.</p>
9191

9292
</section>
93-
{{ sotd(data[vocab_name+'-metadata']) }}
93+
{{ sotd(DPV_VERSION=DPV_VERSION, metadata=data[vocab_name+'-metadata']) }}
9494
{{ dpv_document_family(document='dpv-spec') }}
9595
{% endblock ABSTRACT %}
9696
<section id="vocab-entities">

code/jinja2_resources/template_dpv_legal_basis.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<p>This document provides additional details and examples for legal bases used in the Data Privacy Vocabulary [[DPV]], and is a companion to the [[DPV]] specification.</p>
9191

9292
</section>
93-
{{ sotd(data[vocab_name+'-metadata']) }}
93+
{{ sotd(DPV_VERSION=DPV_VERSION, metadata=data[vocab_name+'-metadata']) }}
9494
{{ dpv_document_family(document='dpv-spec') }}
9595
{% endblock ABSTRACT %}
9696
<section id="vocab-legal-basis">

code/jinja2_resources/template_dpv_personal_data.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<p>This document provides additional details and examples for data and personal data concepts in the Data Privacy Vocabulary [[DPV]], and is a companion to the [[DPV]] specification.</p>
9191

9292
</section>
93-
{{ sotd(data[vocab_name+'-metadata']) }}
93+
{{ sotd(DPV_VERSION=DPV_VERSION, metadata=data[vocab_name+'-metadata']) }}
9494
{{ dpv_document_family(document='dpv-spec') }}
9595
{% endblock ABSTRACT %}
9696
<section id="vocab-personal-data">

code/jinja2_resources/template_dpv_processing.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<p>This document provides additional details and examples for processing and processing context concepts in the Data Privacy Vocabulary [[DPV]], and is a companion to the [[DPV]] specification.</p>
9191

9292
</section>
93-
{{ sotd(data[vocab_name+'-metadata']) }}
93+
{{ sotd(DPV_VERSION=DPV_VERSION, metadata=data[vocab_name+'-metadata']) }}
9494
{{ dpv_document_family(document='dpv-spec') }}
9595
{% endblock ABSTRACT %}
9696
<section id="vocab-processing"><span id="vocab-rights"></span>

0 commit comments

Comments
 (0)