Pārlūkot izejas kodu

Because real beautiful apostrophes matter

master
David Larlet pirms 1 gada
vecāks
revīzija
375ae7a2cc
Šim parakstam datu bāzē netika atrasta zināma atslēga
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  1. 5
    1
      site.py

+ 5
- 1
site.py Parādīt failu

@@ -49,7 +49,11 @@ def parse_markdown(file_path):
"""Extract title, (HTML) content and metadata from a markdown file."""
parser = markdown.Markdown(extensions=["meta"])
with codecs.open(file_path, "r") as source:
content = parser.convert(source.read())
source = source.read()
# Avoid replacing quotes from code #PoorManParsing.
if ":::" not in source and "`" not in source:
source = source.replace("'", "’")
content = parser.convert(source)
metadata = parser.Meta if hasattr(parser, "Meta") else None
title = metadata["title"][0] if metadata is not None else ""
return title, content, metadata

Notiek ielāde…
Atcelt
Saglabāt