Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/schedule/frab_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from main import external_url
from models import event_end, event_start, event_year
from models.cfp import SCHEDULE_ITEM_INFOS, ScheduleItem, Venue
from models.cfp import SCHEDULE_ITEM_INFOS, ScheduleItem, Venue, schedule_item_slug

from . import event_tz
from .data import ScheduleFilter, ScheduleItemDict, _get_occurrence_dict, _get_schedule_item_dict
Expand Down Expand Up @@ -230,7 +230,7 @@ def run(self):
flat_sid["occurrences"][0]["end_date"],
),
"room": room["name"],
"slug": f"""emf{event_year()}-{flat_sid["id"]}-{flat_sid["occurrences"][0]["occurrence_num"]}-""",
"slug": f"""emf{event_year()}-{flat_sid["id"]}-{flat_sid["occurrences"][0]["occurrence_num"]}-{schedule_item_slug(flat_sid["title"], allow_unicode=False)}""",
"url": flat_sid["link"],
"title": flat_sid["title"],
"subtitle": "",
Expand Down Expand Up @@ -359,7 +359,7 @@ def add_event(self, room: Element, room_name: str, flat_sid: ScheduleItemDict) -
self._add_sub_with_text(event, "abstract", flat_sid["description"])
self._add_sub_with_text(event, "description", "")

slug = f"""emf{event_year()}-{flat_sid["id"]}-{flat_sid["occurrences"][0]["occurrence_num"]}-"""
slug = f"""emf{event_year()}-{flat_sid["id"]}-{flat_sid["occurrences"][0]["occurrence_num"]}-{schedule_item_slug(flat_sid["title"], allow_unicode=False)}"""
self._add_sub_with_text(event, "slug", slug)

self._add_sub_with_text(event, "subtitle", "")
Expand Down
6 changes: 3 additions & 3 deletions models/cfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,17 @@ def get_days_map():
return {ed.strftime("%a").lower(): ed for ed in event_days}


def schedule_item_slug(title: str) -> str:
def schedule_item_slug(title: str, allow_unicode: bool = True) -> str:
replacements = [
["'", ""],
]
slug: str = slugify(title, replacements=replacements, allow_unicode=True)
slug: str = slugify(title, replacements=replacements, allow_unicode=allow_unicode)
if len(slug) > 60:
words = re.split(" +|[,.;:!?]+", title)
break_words = ["and", "which", "with", "without", "for", "-", ""]

for i, word in reversed(list(enumerate(words))):
new_slug = slugify(" ".join(words[:i]), replacements=replacements, allow_unicode=True)
new_slug = slugify(" ".join(words[:i]), replacements=replacements, allow_unicode=allow_unicode)
if word in break_words:
if len(new_slug) > 10 and not len(new_slug) > 60:
slug = new_slug
Expand Down
Loading