import logging from pelican import signals from pelican.generators import ArticlesGenerator from pelican.generators import PagesGenerator from pathlib import Path logger = logging.getLogger(__name__) _MAIN_SETTINGS = None # settings dict of the main Pelican instance def process_content(article): """ Substitute the citations and add a bibliography for an article or page, using the local bib file if specified or the global one otherwise. """ content = article._content content = "" + content i = content.count("[lightgallery") if (i <= 0): pass j = content.count("lightgalleryend]") if (j != i): pass logger.info('################################\n') logger.info(str(article.title) + '\n') logger.info('################################\n') for i in range(0, i): m = find_between(content, '[lightgallery', 'lightgalleryend]') imgs = m.split(';') logger.debug("" + article.title + "\n") imgs_text = "" for i in imgs: cont = i.split(',') img_url = cont[0].strip() if img_url == "": continue img_url = img_url img_text = "" if (len(cont) > 1): img_text = "