changeset 1847:d8c6c55aafd7

plugin text syntaxes: fixed defaut syntax handling
author Goffi <goffi@goffi.org>
date Thu, 18 Feb 2016 15:41:47 +0100
parents fdc1dfcee35e
children 446a1539c207
files src/plugins/plugin_misc_text_syntaxes.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_misc_text_syntaxes.py	Wed Feb 10 12:48:19 2016 +0100
+++ b/src/plugins/plugin_misc_text_syntaxes.py	Thu Feb 18 15:41:47 2016 +0100
@@ -122,6 +122,7 @@
 
     def _updateParamOptions(self):
         data_synt = TextSyntaxes.params_data['syntaxes']
+        default_synt = TextSyntaxes.params_data.get('default', _SYNTAX_XHTML)
         syntaxes = []
 
         for syntax in data_synt.keys():
@@ -133,7 +134,7 @@
         options = []
 
         for syntax in syntaxes:
-            selected = 'selected="true"' if syntax == _SYNTAX_XHTML else ''
+            selected = 'selected="true"' if syntax == default_synt else ''
             options.append(u'<option value="%s" %s/>' % (syntax, selected))
 
         TextSyntaxes.params_data["options"] = u'\n'.join(options)
@@ -256,7 +257,7 @@
             raise exceptions.ConflictError(u"This syntax name already exists: {}".format(name))
         syntaxes[name] = {"to": to_xhtml_cb, "from": from_xhtml_cb, "flags": flags}
         if TextSyntaxes.OPT_DEFAULT in flags:
-            syntaxes = TextSyntaxes.params_data['default'] = name
+            TextSyntaxes.params_data['default'] = name
 
         self._updateParamOptions()