From bcd46791a644c74765b997a2742b524e2719ba1a Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 11 Jan 2017 13:53:01 -0500 Subject: [PATCH] fix line breaks in calendar event descriptions Remove line breaks within a paragraph to allow calendar software to handle the text formatting. Change-Id: Ic4c335b9bff7f0213f22c821059d9e0a842b859b Signed-off-by: Doug Hellmann --- doc/source/_exts/ics.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/source/_exts/ics.py b/doc/source/_exts/ics.py index cedec8cbdd..73cd1c7eea 100644 --- a/doc/source/_exts/ics.py +++ b/doc/source/_exts/ics.py @@ -72,6 +72,13 @@ _global_calendar.add('prodid', '-//releases.openstack.org//EN') _global_calendar.add('X-WR-CALNAME', 'OpenStack Release Schedule') +def _format_description(node): + "Given a node, get its text and remove line breaks in paragraphs." + text = node.astext() + parts = text.split('\n\n') + return '\n\n'.join(p.replace('\n', ' ') for p in parts) + + def doctree_resolved(app, doctree, docname): builder = app.builder @@ -132,7 +139,7 @@ def doctree_resolved(app, doctree, docname): # section, then add the full description to the # text. description = [ - doctree.ids[item].astext() + _format_description(doctree.ids[item]) for item in week.get('x-project', []) ] if description: