From 358b7689b3849681f8168b4ed4dfee6ec5e43e53 Mon Sep 17 00:00:00 2001 From: Yves Martin Date: Jan 18 2016 20:33:49 +0000 Subject: Add markup file rendering in Tree browser Any file with markup extension .rst, .md or .mk is rendered as HTML by default in Tree browser. Query parameter "renderMarkup=false" allows to disable markup rendering. This switch is triggered thanks to the "Text" button. The "Blob" button allows to go back to default behaviour, aka markup rendering. Resolves #591 --- diff --git a/pagure/templates/file.html b/pagure/templates/file.html index 3f5b2f6..b5b7600 100644 --- a/pagure/templates/file.html +++ b/pagure/templates/file.html @@ -27,19 +27,25 @@ {% if content %} - {% if output_type == 'file' or output_type == 'binary' or output_type == 'image' %} + {% if output_type in ('file','binary','image','markup') %}
{% if content %} - {% if output_type == 'file' or output_type == 'binary' or output_type == 'image' %} + {% if output_type in ('file','binary','image','markup') %}
- {% if output_type=='file' and repo_admin %} + {% if output_type in ('file','markup') and repo_admin %} Edit {% endif %} + {% if output_type == 'markup' %} + Text + {% else %} Blob + {% endif %} Raw @@ -51,6 +57,10 @@ {% autoescape false %} {{ content | format_loc}} {% endautoescape %} + {% elif output_type == 'markup' %} + {% autoescape false %} + {{ content | noJS }} + {% endautoescape %} {% elif output_type == 'image' %}