From 9e382bb711f2cabc1882fb87d04b54d69b21f8ce Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Mon, 6 Jun 2016 16:29:25 +0000 Subject: [PATCH] Added support for reStructuredText markup in bios. - Legacy-Id: 11284 --- ietf/person/models.py | 2 +- ietf/settings.py | 16 ++++++++++++++++ ietf/templates/person/profile.html | 3 ++- requirements.txt | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ietf/person/models.py b/ietf/person/models.py index dad650a18..7c368cabb 100644 --- a/ietf/person/models.py +++ b/ietf/person/models.py @@ -27,7 +27,7 @@ class PersonInfo(models.Model): ascii_short = models.CharField("Abbreviated Name (ASCII)", max_length=32, null=True, blank=True, help_text="Example: A. Nonymous. Fill in this with initials and surname only if taking the initials and surname of the ASCII name above produces an incorrect initials-only form. (Blank is OK).") affiliation = models.CharField(max_length=255, blank=True, help_text="Employer, university, sponsor, etc.") address = models.TextField(max_length=255, blank=True, help_text="Postal mailing address.") - biography = models.TextField(blank=True, help_text="Short biography for use on leadership pages.") + biography = models.TextField(blank=True, help_text="Short biography for use on leadership pages. Use plain text or reStructuredText markup.") photo = models.ImageField(storage=NoLocationMigrationFileSystemStorage(location=settings.PHOTOS_DIR),upload_to=settings.PHOTOS_DIRNAME,blank=True) photo_thumb = models.ImageField(storage=NoLocationMigrationFileSystemStorage(location=settings.PHOTOS_DIR),upload_to=settings.PHOTOS_DIRNAME,blank=True) diff --git a/ietf/settings.py b/ietf/settings.py index 9785095bf..7b8aa5586 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -271,6 +271,7 @@ INSTALLED_APPS = ( 'form_utils', 'tastypie', 'widget_tweaks', + 'django_markup', # IETF apps 'ietf.api', 'ietf.community', @@ -626,6 +627,20 @@ TRAC_ADMIN_CMD = "/usr/bin/trac-admin" TRAC_WIKI_DIR = "/a/www/www6s/trac" TRAC_SVN_DIR = "/a/svn/group" +MARKUP_SETTINGS = { + 'restructuredtext': { + 'settings_overrides': { + 'initial_header_level': 3, + 'doctitle_xform': False, + 'footnote_references': 'superscript', + 'trim_footnote_reference_space': True, + 'default_reference_context': 'view', + 'link_base': '' + } + } +} + + # Put the production SECRET_KEY in settings_local.py, and also any other # sensitive or site-specific changes. DO NOT commit settings_local.py to svn. from settings_local import * # pyflakes:ignore @@ -651,3 +666,4 @@ if SERVER_MODE != 'production': if 'SECRET_KEY' not in locals(): SECRET_KEY = 'PDwXboUq!=hPjnrtG2=ge#N$Dwy+wn@uivrugwpic8mxyPfHka' ALLOWED_HOSTS = ['*',] + diff --git a/ietf/templates/person/profile.html b/ietf/templates/person/profile.html index 1e70c8bd6..1b73bab44 100644 --- a/ietf/templates/person/profile.html +++ b/ietf/templates/person/profile.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {# Copyright The IETF Trust 2015, All Rights Reserved #} {% load origin %} +{% load markup_tags %} {% block title %}Profile for {{ person }}{% endblock %} @@ -11,7 +12,7 @@
Photo of {{ person }} - {{ person.biography }} + {{ person.biography | apply_markup:"restructuredtext" }}
{% endblock %} diff --git a/requirements.txt b/requirements.txt index ebbe30c8b..c525931c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,7 @@ decorator>=3.4.0 defusedxml>=0.4.1 # for TastyPie when ussing xml; not a declared dependency Django>=1.7.10,<1.8 django-bootstrap3>=5.1.1,<7.0.0 # django-bootstrap 7.0 requires django 1.8 +django-markup>=1.1 django-tastypie>=0.13.1 django-widget-tweaks>=1.3 docutils>=0.12