Anonymous avatar Anonymous committed 76527d4

Make expr editing work work with escaping

Comments (0)

Files changed (2)

txclib/commands.py

             sfile = prj.get_resource_option(res, 'source_file') or "N/A"
             expr = prj.config.get(res, "file_filter")
             # Remove until we figure out a way to edit in a sane way
-            # expr = prj.config.get(res, "file_filter").replace('<lang>', '<span class="lang">&lt;lang&gt;</span>')
-            expr_highlight = expr.replace('<lang>', '<span class="lang">&lt;lang&gt;</span>')
+            # expr_highlight = expr.replace('<lang>', '<span class="lang">&lt;lang&gt;</span>')
+            expr_highlight = expr.replace('<lang>', '$lang')
             res_list.append({'id': res,
                              'p_name': p,
                              'p_url': p_url,
         prj = project.Project(path_to_tx)
         res_id = request.form['res_id']
         expr = request.form['value']
-        logger.info("Changing expression of %s to %s" % (res_id, expr))
-        prj.config.set("%s" % res_id, "file_filter", expr)
+        new_expr = expr.replace('$lang', '<lang>')
+        logger.info("Changing expression of %s to %s" % (res_id, new_expr))
+        prj.config.set("%s" % res_id, "file_filter", new_expr)
         prj.save()
         return expr
 

txclib/templates/home.html

     </td>
     <td>
       <dl>
-        <dd><span class="edit resexpr" data-id="{{ res.id }}">{{ res.expr }}</span></dd>
+        <dd><span class="edit resexpr" data-id="{{ res.id }}">{{ res.expr_highlight }}</span></dd>
       </dl>
     </td>
     <td class="actions">
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.