Only do LaTeX parsing for the pages marked as LaTeX

This commit is contained in:
Fabio Manganiello 2021-08-29 23:06:23 +02:00
parent c2509966aa
commit 44dff804d0
2 changed files with 7 additions and 1 deletions

View file

@ -156,7 +156,12 @@ class LaTeXPreprocessor(markdown.preprocessors.Preprocessor):
def run(self, lines): def run(self, lines):
"""Parses the actual page""" """Parses the actual page"""
# Re-creates the entire page so we can parse in a multine env. # Checks for the LaTeX header
use_latex = any(line == '[//]: # (latex: 1)' for line in lines)
if not use_latex:
return lines
# Re-creates the entire page so we can parse in a multiline env.
page = "\n".join(lines) page = "\n".join(lines)
# Adds a preamble mode # Adds a preamble mode

View file

@ -3,6 +3,7 @@
[//]: # (image: /img/drone-schema.png) [//]: # (image: /img/drone-schema.png)
[//]: # (author: Fabio Manganiello <fabio@platypush.tech>) [//]: # (author: Fabio Manganiello <fabio@platypush.tech>)
[//]: # (published: 2021-08-29) [//]: # (published: 2021-08-29)
[//]: # (latex: 1)
Drones are increasingly popular and affordable nowadays, and they have become a popular toy for kids and adults Drones are increasingly popular and affordable nowadays, and they have become a popular toy for kids and adults
of all ages. If all you need is a flying camera to take your holiday selfies then an off-the-shelf solution may of all ages. If all you need is a flying camera to take your holiday selfies then an off-the-shelf solution may