# -*- coding: utf-8 -*- """ Latex Plugin For Pelican ======================== This plugin allows you to write mathematical equations in your articles using Latex. It uses the MathJax Latex JavaScript library to render latex that is embedded in between `$..$` for inline math and `$$..$$` for displayed math. It also allows for writing equations in by using `\begin{equation}`...`\end{equation}`. """ from pelican import signals latexScript = """ """ def addLatex(gen, metadata): """ The registered handler for the latex plugin. It will add the latex script to the article metadata """ if 'LATEX' in gen.settings.keys() and gen.settings['LATEX'] == 'article': if 'latex' in metadata.keys(): metadata['latex'] = latexScript else: metadata['latex'] = latexScript def register(): """ Plugin registration """ signals.article_generator_context.connect(addLatex) signals.page_generator_context.connect(addLatex)