--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<django-objects version="1.0"><object pk="2" model="toolbar.buttongroup"><field type="CharField" name="name">Autokorekta</field><field type="SlugField" name="slug">autokorekta</field><field type="IntegerField" name="position">0</field></object><object pk="1" model="toolbar.buttongroup"><field type="CharField" name="name">Formatowanie</field><field type="SlugField" name="slug">formatowanie</field><field type="IntegerField" name="position">0</field></object><object pk="4" model="toolbar.button"><field type="CharField" name="label">Novelpages</field><field type="SlugField" name="slug">novelpages</field><field type="TextField" name="params">({exprs: [\r\r
+ ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."],\r\r
+ ["„", ",,"] /* DOUBLE LOW-9 QUOTATION MARK */\r\r
+]})\r\r
+ </field><field to="toolbar.scriptlet" name="scriptlet" rel="ManyToOneRel">lineregexp</field><field type="CharField" name="key"></field><field type="CharField" name="tooltip">Wykonuję operację z novel-pages.</field><field to="toolbar.buttongroup" name="group" rel="ManyToManyRel"><object pk="2"></object></field></object><object pk="3" model="toolbar.button"><field type="CharField" name="label">Usuń spację</field><field type="SlugField" name="slug">strip_whitespace</field><field type="TextField" name="params">({exprs: [ ["^\\s+|\\s+$", ""], ["\\s+", " "] ]})</field><field to="toolbar.scriptlet" name="scriptlet" rel="ManyToOneRel">lineregexp</field><field type="CharField" name="key"></field><field type="CharField" name="tooltip">Usuwa zbędne spację z dokumentu.</field><field to="toolbar.buttongroup" name="group" rel="ManyToManyRel"><object pk="2"></object></field></object><object pk="1" model="toolbar.button"><field type="CharField" name="label">Wers</field><field type="SlugField" name="slug">insert_verse</field><field type="TextField" name="params">({tag: 'wers'})</field><field to="toolbar.scriptlet" name="scriptlet" rel="ManyToOneRel">insert_tag</field><field type="CharField" name="key">w</field><field type="CharField" name="tooltip">Otacza zaznaczony tekst tagiem 'wers'.</field><field to="toolbar.buttongroup" name="group" rel="ManyToManyRel"><object pk="1"></object></field></object><object pk="2" model="toolbar.button"><field type="CharField" name="label">Zamień dywiz</field><field type="SlugField" name="slug">zamien_dywiz</field><field type="TextField" name="params">({exprs:[ ["—","---"] ]})</field><field to="toolbar.scriptlet" name="scriptlet" rel="ManyToOneRel">lineregexp</field><field type="CharField" name="key"></field><field type="CharField" name="tooltip">Zamienia '—' na '---'.</field><field to="toolbar.buttongroup" name="group" rel="ManyToManyRel"><object pk="2"></object></field></object><object pk="insert_tag" model="toolbar.scriptlet"><field type="TextField" name="code">$.log(editor, panel, params);\r\r
+\r\r
+var texteditor = panel.texteditor;\r\r
+var text = texteditor.selection();\r\r
+texteditor.replaceSelection('<' + params.tag + '>' + text + '</' + params.tag + '>');\r\r
+if (text.length == 0) \r\r
+{\r\r
+ var pos = texteditor.cursorPosition();\r\r
+ texteditor.selectLines(pos.line, pos.character + params.tag.length + 2);\r\r
+}\r\r
+\r\r
+panel.fireEvent('contentChanged');</field></object><object pk="lineregexp" model="toolbar.scriptlet"><field type="TextField" name="code">// params: {exprs: list of {expr: "", repl: "" [, opts: "g"]}}\r\r
+var cm = panel.texteditor;\r\r
+\r\r
+var exprs = $.map(params.exprs, function(expr) {\r\r
+ var opts = "g";\r\r
+ if(expr.length > 2)\r\r
+ opts = expr[2];\r\r
+ return {rx: new RegExp(expr[0], opts), repl: expr[1]};\r\r
+});\r\r
+\r\r
+var selection = cm.selection();\r\r
+\r\r
+if(selection) \r\r
+{\r\r
+ var lines = selection.split('\n');\r\r
+ lines = $.map(lines, function(line) { \r\r
+ $(exprs).each(function() { \r\r
+ var expr = this;\r\r
+ line = line.replace(expr.rx, expr.repl);\r\r
+ });\r\r
+ return line;\r\r
+ });\r\r
+ cm.replaceSelection( lines.join('\n') );\r\r
+}\r\r
+else {\r\r
+ var line = cm.firstLine();\r\r
+ do {\r\r
+ var content = cm.lineContent(line);\r\r
+ $.log("Swapping line: $" + content + "$");\r\r
+ \r\r
+ $(exprs).each(function() { var expr = this;\r\r
+ content = content.replace(expr.rx, expr.repl);\r\r
+ });\r\r
+ cm.setLineContent(line, content);\r\r
+ line = cm.nextLine(line);\r\r
+ } while( !(line === false) );\r\r
+}</field></object></django-objects>\r