import re def adapt(text, title, layout): text = correct_assets(text, layout) text = add_load_static(text) text = add_meta_data(text) text = correct_title(text, title) text = add_icons(text) text = add_back_to_articles(text) # text = correct_links(text) # text = correct_scripts(text) text = add_mathjax(text) text = add_plantuml(text) text = add_back_to_top_button(text) text = add_scroll_support(text) text = correct_check(text) return text def add_load_static(text): """Add load static on top of the file.""" return "{% load static %}" + text def add_back_to_articles(text): text = text.replace( '
Back to articles
', ) return text def correct_title(text, title): """Put the true title.""" pattern = re.compile(r"