Skip to content

Use DPV_VERSION instead of a fixed version number when generate Search Index/image URL #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

bact
Copy link
Collaborator

@bact bact commented Mar 27, 2025

Pull Request

Use {{DPV_VERSION}} in templates, instead of a fixed version, when generate URLs for:

  • Search Index in sotd macro in code/jinja2_resources/macro_dpv_document_family.jinja2
  • Image source in code/jinja2_resources/template_guides_rights.jinja2

This PR also modifies ./300_generate_HTML.py to pass the constant DPV_VERSION to mappings generation.

Tested with ./300_generate_HTML.py --guides --mappings, the relevant URLs generated using the value from DPV_VERSION in vocab_management.py.

bact added 2 commits March 27, 2025 18:50
Use {{DPV_VERSION}} in URL, instead of a fixed version

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact added the code label Mar 27, 2025
@@ -1071,10 +1071,10 @@ def add_item_to_index(iri):
filepath = f"{data['output']}"
with open(filepath, 'w') as fd:
template = template_env.get_template(template)
fd.write(template.render(data=data))
fd.write(template.render(DPV_VERSION=DPV_VERSION, data=data))
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is needed, keep this

INFO(f"wrote guide {doc} at {filepath}")
with open('../mappings/index.html', 'w') as fd:
template = template_env.get_template('template_mappings_index.jinja2')
fd.write(template.render(mappings=MAPPINGS.items()))
fd.write(template.render(DPV_VERSION=DPV_VERSION, mappings=MAPPINGS.items()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is needed, keep this

@coolharsh55
Copy link
Collaborator

Thanks @bact I think there is an easier way to do this without requiring manually inserting the version in each file.

'DPV_VERSION': DPV_VERSION,
should ensure DPV_VERSION is accessible directly within the template without passing it as a variable (except for mappings, where it will be needed). I'll try that, and if it works close this without merging. Otherwise we'll go with your solution.

@coolharsh55 coolharsh55 self-assigned this Mar 28, 2025
coolharsh55 added a commit that referenced this pull request Apr 7, 2025
closes #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>
@coolharsh55 coolharsh55 closed this Apr 7, 2025
@bact bact deleted the use-version-var-in-search-link branch April 7, 2025 06:31
coolharsh55 added a commit that referenced this pull request Apr 7, 2025
- #273 use DPV_VERSION in links
- #274 stable BNode ids for contributors, orgs, sources
- #271 typos in references
- #265 -- same as #274
- changes affect all RDF and HTML
- this commit should be the last commit where random BNodes are used for
  person etc. and the subsequent commits should be cleaner

Co-authored-by: Arthit Suriyawongkul <arthit@gmail.com>
coolharsh55 added a commit that referenced this pull request Apr 12, 2025
closes #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>
(cherry picked from commit c83d97b)
coolharsh55 added a commit that referenced this pull request Apr 12, 2025
Squashed commit of the following:

commit 95f4d57
Author: Harshvardhan Pandit <me@harshp.com>
Date:   Sat Apr 12 16:44:09 2025 +0100

    update changelog

commit 8ef2021
Author: Harshvardhan Pandit <me@harshp.com>
Date:   Sat Apr 12 12:50:43 2025 +0100

    added ReSpec outputs for HTML

commit 93c2a4a
Author: Harshvardhan Pandit <me@harshp.com>
Date:   Sat Apr 12 11:39:23 2025 +0100

    add HTML outputs

commit d5d36c1
Author: Harshvardhan Pandit <me@harshp.com>
Date:   Mon Apr 7 05:55:27 2025 +0100

    HTML outputs use DPV_VERSION not hardcoded version

    closes #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>
    (cherry picked from commit c83d97b)

commit f401d84
Author: Arthit Suriyawongkul <arthit@gmail.com>
Date:   Mon Apr 7 05:22:31 2025 +0100

    Fix typos and JSON format in references.json and templates (#271)

    - references.json
      - Contraint -> Constraint
      - Fix JSON format: Remove comma after the last item in a dictionary
      - Update full URL for http://www.ruleml.org/
        - Note that ruleml.org domain is squatted and the content is no longer about the original RuleML
    - Jinja templates
      - ambigious -> ambiguous
      - occured -> occurred
        - Note that the same 'occured' typos also occurred in terms' description. For example, in `dex:E0069`, `risk-owl:Incident`, and `ai-owl:RepairStage`
    - vocab_management.py
      - Removes double spaces inside metadata description strings

    Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
    (cherry picked from commit 758ac0b)

commit 50eeb69
Author: Arthit Suriyawongkul <arthit@gmail.com>
Date:   Mon Apr 7 05:14:37 2025 +0100

    README: Update links, fix typos, fix Markdownlint warnings (#263)

    * README: Update links, fix typos, fix Markdownlint warnings

    - Update link to Contribution Guide wiki
    - Fix link: legal/usa -> legal/us
    - Fix typo: succint -> succinct
    - Remove a duplicated instance of LEGAL-GB in Final Reports/DPV 2.1 list (there was two, one after France [FR-GB] and another before US [United Kingdom-United States])
    - Fix Markdownlint warnings (inconsistent used of bullet symbols, extra spaces at the end of line, etc)
    - Also remove one extra end quote from CITATION.cff

    Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>

    * Fix IRI typos in README.md

    ---------

    Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
    Co-authored-by: Harshvardhan Pandit <me@harshp.com>
    (cherry picked from commit cce40f6)

commit 3b2f7a0
Author: Arthit Suriyawongkul <arthit@gmail.com>
Date:   Mon Mar 24 15:46:16 2025 +0000

    Add v2.1 section for 404 page

    - Add a tree of DPV v2.1 resource
    - Update version number in common cause error suggestion

    Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
    (cherry picked from commit 09d7298)

commit 0f25826
Author: Arthit Suriyawongkul <arthit@gmail.com>
Date:   Fri Mar 28 08:57:00 2025 +0000

    Fix typos in aspell dictionary

    - ImmigrationDocumentVerficiation -> ImmigrationDocumentVerification
    - LawfulnessUnkown -> LawfulnessUnknown

    Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
    (cherry picked from commit aeab59d)

Co-authored-by: Arthit Suriyawongkul <arthit@gmail.com>
Co-authored-by: TyttiKatariina <166048240+TyttiKatariina@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants