You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB
Python

from pelican import signals
def split_to_quotes_section(article):
article_sections = article._content.split('<!--quotes-->');
article._content = article_sections[0]
if len(article_sections) > 1:
article.quotes = article_sections[1]
def split_to_bio_section(article):
article_sections = article._content.split('<!--bio-->');
article._content = article_sections[0]
if len(article_sections) > 1:
article.bio = article_sections[1]
def article_add_quotes(article_generator):
for article in article_generator.articles:
split_to_quotes_section(article)
for translation in article.translations:
split_to_quotes_section(translation)
def page_add_bio(page_generator):
for page in page_generator.pages:
split_to_bio_section(page)
for translation in page.translations:
split_to_bio_section(translation)
def register():
signals.article_generator_finalized.connect(article_add_quotes)
signals.page_generator_finalized.connect(page_add_bio)