Skip to content

Commit

Permalink
Update linking
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenrouwhof committed Sep 23, 2024
1 parent 6e41c4b commit 7d6f3cc
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/overrides/hooks/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
from re import Match
import json

# Define _create_chip first to ensure it's available for _create_table_row_2
def _create_chip(item: str, chip_type: str) -> str:
# Updated _create_chip function to use the same linking logic as "maatregelen"
def _create_chip(item: str, chip_type: str, base_url: str, config: MkDocsConfig) -> str:
if not item:
return ""

icon_svg, color_class = "", ""
base_url = "/"

# Determine chip-specific styles and icons
if chip_type == 'rol':
Expand Down Expand Up @@ -58,10 +57,10 @@ def _create_table_row_2(file: File, filter_options: Dict[str, bool], current_fil
onderwerpen = file.page.meta.get('onderwerp', [])
vereiste = file.page.meta.get('vereiste', [])

rollen_chips = ''.join(_create_chip(rol, 'rol') for rol in rollen) if filter_options.get("rol", True) else ""
levenscyclus_chips = ''.join(_create_chip(lc, 'levenscyclus') for lc in levenscyclus) if filter_options.get("levenscyclus", True) else ""
onderwerp_chips = ''.join(_create_chip(onderwerp, 'onderwerp') for onderwerp in onderwerpen) if filter_options.get("onderwerp", True) else ""
vereiste_chips = ''.join(_create_chip(vereiste, 'vereiste') for vereiste in vereiste) if filter_options.get("vereiste", True) else ""
rollen_chips = ''.join(_create_chip(rol, 'rol', base_url, config) for rol in rollen) if filter_options.get("rol", True) else ""
levenscyclus_chips = ''.join(_create_chip(lc, 'levenscyclus', base_url, config) for lc in levenscyclus) if filter_options.get("levenscyclus", True) else ""
onderwerp_chips = ''.join(_create_chip(onderwerp, 'onderwerp', base_url, config) for onderwerp in onderwerpen) if filter_options.get("onderwerp", True) else ""
vereiste_chips = ''.join(_create_chip(vereiste, 'vereiste', base_url, config) for vereiste in vereiste) if filter_options.get("vereiste", True) else ""

return "".join(
[
Expand Down Expand Up @@ -232,7 +231,7 @@ def replace_vereisten_content(file: File):
flags=re.I | re.M,
)

file.page.content = re.sub(
file.page.content is re.sub(
r"<!-- list_instrumenten(.*?) -->",
lambda match: replace_content(match, "instrumenten"),
file.page.content,
Expand Down

0 comments on commit 7d6f3cc

Please sign in to comment.