X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/d8ac9c9786c906979c58e97b7c6df302c5d32770..7ba0bf0e4c5325d2f78ae640568e6de9ea3e9440:/fixtures/przyciski.xml?ds=inline
diff --git a/fixtures/przyciski.xml b/fixtures/przyciski.xml
index a8ad2c19..ea1d7246 100644
--- a/fixtures/przyciski.xml
+++ b/fixtures/przyciski.xml
@@ -1,53 +1,1108 @@
-
-UsuÅ spacjÄstrip_whitespace({exprs: [ ["^\\s+|\\s+$", ""], ["\\s+", " "] ]})lineregexpUsuwa zbÄdne spacjÄ z dokumentu.Wersinsert_verse({tag: 'wers'})insert_tagwOtacza zaznaczony tekst tagiem 'wers'.ZamieÅ dywizzamien_dywiz({exprs:[ ["â","---"] ]})lineregexpZamienia 'â' na '---'.$.log(editor, panel, params);
-
-var texteditor = panel.texteditor;
-var text = texteditor.selection();
-texteditor.replaceSelection('<' + params.tag + '>' + text + '</' + params.tag + '>');
-if (text.length == 0) 
-{
-    var pos = texteditor.cursorPosition();
-    texteditor.selectLines(pos.line, pos.character + params.tag.length + 2);
-}
-
-panel.fireEvent('contentChanged');// params: {exprs: list of {expr: "", repl: "" [, opts: "g"]}}
-var cm = panel.texteditor;
-
-var exprs = $.map(params.exprs, function(expr) {
-    var opts = "g";
-    if(expr.length > 2)
-        opts = expr[2];
-    return {rx: new RegExp(expr[0], opts), repl: expr[1]};
-});
-
-var selection = cm.selection();
-
-if(selection) 
-{
-    var lines = selection.split('\n');
-    lines = $.map(lines, function(line) { 
-        $(exprs).each(function() { 
-            var expr = this;
-            line = line.replace(expr.rx, expr.repl);
-        });
-        return line;
-    });
-    cm.replaceSelection( lines.join('\n') );
-}
-else {
-    var line = cm.firstLine();
-    do {
-        var content = cm.lineContent(line);
-        $.log("Swapping line: $" + content + "$");
-    
-        $(exprs).each(function() { var expr = this;
-            content = content.replace(expr.rx, expr.repl);
-        });
-        cm.setLineContent(line, content);
-        line = cm.nextLine(line);
-    } while( !(line === false) );
-}
+
+
+  
+    Akapity i dÅugie cytaty
+    akapity-i-dlugie-cytaty
+    0
+  
+  
+    Autokorekta
+    autokorekta
+    0
+  
+  
+    Bloki
+    bloki
+    0
+  
+  
+    Bloki poczÄ
tkowe
+    bloki-poczatkowe
+    0
+  
+  
+    Deklaracje
+    deklaracje
+    0
+  
+  
+    Dramat wierszowany
+    dramat-wierszowany
+    0
+  
+  
+    Dramat wspóÅczesny
+    dramat-wspolczesny
+    0
+  
+  
+    Elementy poczÄ
tkowe
+    elementy-poczatkowe
+    0
+  
+  
+    Mastery
+    mastery
+    0
+  
+  
+    NagÅówki
+    naglowki
+    0
+  
+  
+    PoczÄ
tek dramatu
+    poczatek-dramatu
+    0
+  
+  
+    Polecenia
+    polecenia
+    0
+  
+  
+    Strukturalne
+    strukturalne
+    0
+  
+  
+    Style znakowe
+    style-znakowe
+    0
+  
+  
+    Wersy
+    wersy
+    0
+  
+  
+    Widok
+    display_options
+    2
+  
+  
+    A<sup>+</sup>
+    increase_font_size
+    {"change": 2}
+    codemirror_fontsize
+    +
+    ZwiÄksz rozmiar czcionki.
+    
+      
+    
+  
+  
+    A<sup>-</sup>
+    descrease_font_size
+    {"change": -2}
+    codemirror_fontsize
+    -
+    Zmniejsz rozmiar czcionki.
+    
+      
+    
+  
+  
+    A<sup>=</sup>
+    reset_font_size
+    {"fontSize": 13}
+    codemirror_fontsize
+    =
+    PrzywrÃ³Ä orginalny rozmiar czcionki.
+    
+      
+    
+  
+  
+    A<sup>â</sup>
+    tolowercase
+    []
+    lowercase
+    u
+    ZamieÅ wielkie litery na maÅe.
+    
+      
+    
+  
+  
+    Podstawowa
+    basic_correction
+    {"exprs": [["\n\\d+\n", "\n"], ["-\\s*\n+", ""], ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."]]}
+    fulltextregexp
+    
+    WykonujÄ operacjÄ z novel-pages i poem-pages.
+    
+      
+    
+  
+  
+    UsuÅ spacjÄ
+    strip_whitespace
+    {"exprs": [["^\\s+|\\s+$", ""], ["\\s+", " "]]}
+    lineregexp
+    
+    Usuwa zbÄdne spacjÄ z dokumentu.
+    
+      
+    
+  
+  
+    ZamieÅ CudzysÅowy
+    zamien-cudzyslowy
+    {"exprs": [["\u00bb|\u201e", ",,"], ["\u00ab", "\""], ["\"([\u0104\u0118\u00d3\u0141\u017b\u0179\u0106\u0143\u0105\u017c\u017a\u015b\u0144\u00f3\u0142\u0107\\w])", ",,$1"]]}
+    lineregexp
+    
+    
+    
+      
+    
+  
+  
+    ZamieÅ dywiz
+    zamien_dywiz
+    {"exprs": [["(\\d)[\u2014-](\\d)", "$1--$2"], ["\u2014", "---"]]}
+    lineregexp
+    
+    Zamienia 'â' na '---', oraz '1â2' na '1--2'.
+    
+      
+    
+  
+  
+    akapit
+    akapit
+    {"tag": "akap"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    akapit cd.
+    akapit-cd
+    {"tag": "akap_cd"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    akapit dialogowy
+    akapit-dialogowy
+    {"tag": "akap_dialog"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    akt
+    akt
+    {"tag": "akt"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    autor
+    autor
+    {"tag": "autor"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    czÄÅÄ/ksiÄga
+    czesc
+    {"tag": "naglowek_czesc"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dedykacja
+    dedykacja
+    {"tag": "dedykacja"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dedykacja
+    dedykacja
+    {"tag": "dedykacja"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    didaskalia
+    didaskalia
+    {"tag": "didaskalia"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    didaskalia
+    didaskalia
+    {"tag": "didaskalia"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    didaskalia wewn.
+    didaskalia-wewn
+    {"tag": "didask_tekst"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    didaskalia wewn.
+    didaskalia-wewn
+    {"tag": "didask_tekst"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dramat wiersz.
+    dramat-wiersz
+    {"tag": "dramat_wierszowany_l"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dramat wiersz./w. Åam
+    dramat-wiersz-w-lam
+    {"tag": "dramat_wierszowany_lp"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dramat wspóÅczesny
+    dramat-wspolczesny
+    {"tag": "dramat_wspolczesny"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dzieÅo nadrzÄdne
+    dzielo-nadrzedne
+    {"tag": "dzielo_nadrzedne"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dÅugi cyt. poet.
+    dlugi-cyt-poet
+    {"tag": "poezja_cyt"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dÅugi cyta. poet.
+    dlugi-cyt-poet
+    {"tag": "poezja_cyt"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    dÅugi cytat
+    dlugi-cytat
+    {"tag": "dlugi_cyt"}
+    insert_tag
+    
+    
+    
+      
+      
+    
+  
+  
+    ekstra
+    ekstra
+    {"tag": "ekstra"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    kwestia
+    kwestia
+    {"tag": "kwestia"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    kwestia
+    kwestia
+    {"tag": "kwestia"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    liryka
+    liryka
+    {"tag": "liryka_l"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    liryka/w. Åam
+    liryka-w-lam
+    {"tag": "liryka_lp"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    mamtemat.
+    matemat
+    {"tag": "mat"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    motto
+    motto
+    {"tag": "motto"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    motto
+    motto
+    {"tag": "motto"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    motto podpis
+    motto-podpis
+    {"tag": "motto_podpis"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    nagÅówek kwestii
+    naglowek-kwestii
+    {"tag": "naglowek_osoba"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    nota
+    nota
+    {"tag": "nota"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    opowiadanie
+    opowiadanie
+    {"tag": "opowiadanie"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    osoba
+    osoba
+    {"tag": "osoba"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    osoba
+    osoba
+    {"tag": "osoba"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    podrozdziaÅ
+    podrozdzial
+    {"tag": "naglowek_podrozdzial"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    podtytuÅ
+    podtytul
+    {"tag": "podtytul"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    powieÅÄ
+    powiesc
+    {"tag": "powiesc"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    przypis autorski
+    przypis-autorski
+    {"tag": "pa"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    przypis edytorski
+    przypis-edytorski
+    {"tag": "pe"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    przypis redaktorski
+    przypis-redaktorski
+    {"tag": "pr"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    przypis tÅumacza
+    przypis-tlumacza
+    {"tag": "pt"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    rozdziaÅ
+    rozdzial
+    {"tag": "naglowek_rozdzial"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    scena
+    scena
+    {"tag": "naglowek_scena"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    sep. asteryks
+    sep-asteryks
+    {"tag": "sekcja_asteryks"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    sep. linia
+    sep-linia
+    {"tag": "separator_linia"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    sep. ÅwiatÅo
+    sep-swiatlo
+    {"tag": "sekcja_swiatlo"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    strofa
+    strofa
+    {"tag": "strofa"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    sÅowo obce
+    slowo-obce
+    {"tag": "slowo_obce"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    tagi gÅówne
+    tagi-glowne
+    {"tag": "utwor"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    tytuÅ
+    tytul
+    {"tag": "nazwa_utworu"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    tytuÅ dzieÅa
+    tytul-dziela
+    {"tag": "tytul_dziela", "attrs": {"typ": " "}}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    uwaga
+    uwaga
+    {"tag": "uwaga"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wers akap.
+    wers-akap
+    {"tag": "wers_akap"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wers akap.
+    wers-akap
+    {"tag": "wers_akap"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wers cd.
+    wers-cd
+    {"tag": "wers_cd"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wers cd.
+    wers-cd
+    {"tag": "wers_cd"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wers wciÄty
+    wers-wciety
+    {"tag": "wers_wciety"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wers wciÄty
+    wers-wciety
+    {"tag": "wers_wciety"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    www
+    www
+    {"tag": "www"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wyróżnienie
+    wyroznienie
+    {"tag": "wyroznienie"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wywiad
+    wywiad
+    {"tag": "wywiad"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wywiad odpowiedź
+    wywiad-odpowiedz
+    {"tag": "wywiad_odp"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    wywiad pytanie
+    wywiad-pytanie
+    {"tag": "wywiad_pyt"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    zastÄpnik wersu
+    zastepnik-wersu
+    {"tag": "zastepnik_wersu"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    ÅródtytuÅ
+    srodtytul
+    {"tag": "srodtytul"}
+    insert_tag
+    
+    
+    
+      
+    
+  
+  
+    var texteditor = panel.texteditor;
+
+var text = texteditor.selection();
+
+var out = '<'+params.tag;
+
+for (var attr in params.attrs) {
+
+    out += ' '+attr+'="' + params.attrs[attr] + '"';
+
+};
+
+out += '>';
+
+out += text;
+
+out += '</' + params.tag + '>';
+
+ 
+
+texteditor.replaceSelection(out);
+
+
+
+if (text.length == 0) {
+
+    var pos = texteditor.cursorPosition();
+
+    texteditor.selectLines(pos.line, pos.character + params.tag.length + 2);
+
+}
+
+
+
+panel.fireEvent('contentChanged');
+  
+  
+    // params: {exprs: list of {expr: "", repl: "" [, opts: "g"]}}
+
+var cm = panel.texteditor;
+
+
+
+var exprs = $.map(params.exprs, function(expr) {
+
+    var opts = "g";
+
+    if(expr.length > 2)
+
+        opts = expr[2];
+
+    return {rx: new RegExp(expr[0], opts), repl: expr[1]};
+
+});
+
+
+
+var partial = true;
+
+var text = cm.selection();
+
+
+
+if(!text) {
+
+    var cpos = cm.cursorPosition();
+
+    cpos.line = cm.lineNumber(cpos.line)
+
+    cm.selectLines(cm.firstLine(), 0, cm.lastLine(), 0);
+
+    text = cm.selection();
+
+    partial = false;
+
+}
+
+
+
+var changed = false;
+
+var lines = text.split('\n');
+
+var lines = $.map(lines, function(line) { 
+
+    var old_line = line;
+
+    $(exprs).each(function() { 
+
+        var expr = this;
+
+        line = line.replace(expr.rx, expr.repl);
+
+    });
+
+    if(old_line != line) changed = true;
+
+    return line;
+
+});
+
+
+
+if(changed) 
+
+{
+
+    cm.replaceSelection( lines.join('\n') );
+
+    panel.fireEvent('contentChanged');
+
+}
+
+
+
+if(!partial)
+
+    cm.selectLines( cm.nthLine(cpos.line), cpos.character )
+  
+  
+    var texteditor = panel.texteditor;
+
+var frameBody = $('body', $(texteditor.frame).contents());
+
+
+
+if(params.fontSize) {
+
+    frameBody.css('font-size', params.fontSize);
+
+}
+
+else {
+
+    var old_size = parseInt(frameBody.css('font-size'));
+
+    frameBody.css('font-size', old_size + (params.change || 0) );
+
+}
+  
+  
+    var cm = panel.texteditor;
+
+var exprs = $.map(params.exprs, function(expr) {
+
+    var opts = "mg";
+
+    if(expr.length > 2)
+
+        opts = expr[2];
+
+    return {rx: new RegExp(expr[0], opts), repl: expr[1]};
+
+});
+
+
+
+var partial = true;
+
+var text = cm.selection();
+
+
+
+if(!text) {
+
+    var cpos = cm.cursorPosition();
+
+    cpos.line = cm.lineNumber(cpos.line)
+
+    cm.selectLines(cm.firstLine(), 0, cm.lastLine(), 0);
+
+    text = cm.selection();
+
+    partial = false;
+
+}
+
+
+
+var original = text;
+
+
+
+$(exprs).each(function() { 
+
+    text = text.replace(this.rx, this.repl);
+
+});
+
+
+
+if( original != text) {
+
+    cm.replaceSelection(text);
+
+    panel.fireEvent('contentChanged');
+
+}
+
+
+
+if(!partial) {
+
+    cm.selectLines( cm.nthLine(cpos.line), cpos.character );
+
+}
+  
+  
+    params.each(function() {
+
+    editor.callScriptlet(this[0], this[1]);
+
+});
+  
+  
+    var cm = panel.texteditor;
+
+var text = cm.selection();
+
+if(!text) return;
+
+var repl = text.toLowerCase();
+
+if(repl != text) {
+
+    cm.replaceSelection(repl);
+
+    panel.fireEvent('contentChanged');
+
+};
+  
+