From 731937b89af96807cc4e8ef0767696cb345ea219 Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 14 Feb 2014 19:56:28 +0100 Subject: [PATCH] Correction d'un bug dans l'utilisation de PlasTeX --- songbook/plastex-songs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/songbook/plastex-songs.py b/songbook/plastex-songs.py index d9a71512..6d409d8d 100644 --- a/songbook/plastex-songs.py +++ b/songbook/plastex-songs.py @@ -30,8 +30,12 @@ class beginsong(plasTeX.Command): # Parsing keyval arguments args = {} for (key, val) in self.attributes['args'].iteritems(): - if type(val) == unicode: + if isinstance(val, plasTeX.DOM.Element): + args[key] = val.textContent.encode('utf-8') + elif isinstance(val, unicode): + args[key] = val.encode('utf-8') + elif isinstance(val, str): args[key] = val.encode('utf-8') else: - args[key] = val.textContent.encode('utf-8') + args[key] = unicode(val) self.attributes['args'] = args