Skip to content

Commit

Permalink
Inherit English properties correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
verhovsky committed Dec 9, 2024
1 parent c56404e commit fd25fd1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ def replacer(match) -> str:
highlighted = pygments.highlight(code, lexer, formatter)

if lang:
return f'<div class="highlight"><pre lang="{lang}">{highlighted}</pre></div>'
return (
f'<div class="highlight"><pre lang="{lang}">{highlighted}</pre></div>'
)
return f'<div class="highlight"><pre>{highlighted}</pre></div>'

result = code_expr.sub(replacer, html)
Expand Down Expand Up @@ -188,7 +190,7 @@ def count_contributors(path):


def twitter_share_url(url, doc):
full_url = "https://learnxinyminutes.com" + (('/' + url) if url else "")
full_url = "https://learnxinyminutes.com" + (("/" + url) if url else "")
text = doc or ""
qs = urlencode({"url": full_url, "text": text})
return f"https://twitter.com/intent/tweet?{qs}"
Expand All @@ -209,7 +211,7 @@ def twitter_share_url(url, doc):
orig_language = language = filename.stem.split(".")[0]
if len(filename.parts) > 3:
orig_lang = lang = filename.parts[2]
if re.search(r"-[a-z]{2}$", language):
if re.search(r"-[a-z]{2}$", language) and language != "standard-ml":
language = language.rsplit("-", 1)[0]
lang = lang_map.get(lang, lang)

Expand Down Expand Up @@ -280,7 +282,7 @@ def get_category_display_name(c):
for language in articles:
for lang, article in articles[language].items():
metadata = article.metadata
if "en" in language:
if "en" in articles[language]:
metadata = {**articles[language]["en"].metadata, **metadata}

content = article.content
Expand Down

0 comments on commit fd25fd1

Please sign in to comment.