Skip to content

Commit

Permalink
feat(devtools): allow underscore in skill filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Jan 22, 2022
1 parent 07cff9c commit 4d40fc9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions apps/tools/librelingo_tools/lili.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,15 @@ def guess_path_to_course(path_to_course):
return path_to_course


def skillfile_filter(path):
match = re.search(r"^([a-z0-9]+)/skills/([a-z0-9_-]+)\.yaml$", path)
def parse_skill_path(path):
match = re.search(r"^([a-zA-Z0-9-]+)/skills/([a-zA-Z0-9_-]+)\.yaml$", path)
if not match:
raise Exception(f"unrecoginized skill path: '{path}'")
return match


def skillfile_filter(path):
match = parse_skill_path(path)
# return match.group(1) + '/' + match.group(2)
return match.group(2)

Expand Down Expand Up @@ -147,9 +152,7 @@ def export_skill_html_pages(course, count, reldir, html_dir):
skill=skill,
repository_url=get_repository_url(course),
)
match = re.search(r"^([a-z0-9]+)/skills/([a-z0-9_-]+).yaml", skill.filename)
if match is None:
exit(skill.filename)
match = parse_skill_path(skill.filename)
module_name = match.group(1)
file_name = match.group(2)
dir_path = os.path.join(html_dir, "course", module_name, "skills")
Expand Down

0 comments on commit 4d40fc9

Please sign in to comment.