X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/308aa7c7d75b50a4b36a70681b5e012dbd023c11..fc7a60feb9496c250cd1e8ca3db8c74267790047:/fixtures/przyciski.xml diff --git a/fixtures/przyciski.xml b/fixtures/przyciski.xml old mode 100644 new mode 100755 index 1794c6d7..2065b151 --- a/fixtures/przyciski.xml +++ b/fixtures/przyciski.xml @@ -1,5 +1,15 @@ + + Dodatkowe przyciski w XMLEditor + xmleditor-extra-buttons + -1 + + + HTMLEditor Extra + htmleditor-extra + -1 + Akapity i długie cytaty akapity-i-dlugie-cytaty @@ -15,16 +25,6 @@ bloki 0 - - Bloki początkowe - bloki-poczatkowe - 0 - - - Deklaracje - deklaracje - 0 - Dramat wierszowany dramat-wierszowany @@ -40,11 +40,6 @@ elementy-poczatkowe 0 - - Mastery - mastery - 0 - Nagłówki naglowki @@ -75,50 +70,162 @@ wersy 0 - - Widok - display_options - 2 - A<sup>+</sup> increase_font_size - ({change: 2}) + {"change": 2} codemirror_fontsize - + + + + 0 Zwiększ rozmiar czcionki. - + A<sup>-</sup> descrease_font_size - ({change: -2}) + {"change": -2} codemirror_fontsize - - + + + 0 Zmniejsz rozmiar czcionki. - + A<sup>=</sup> reset_font_size - ({fontSize: 13}) + {"fontSize": 13} codemirror_fontsize - = + + + 0 Przywróć orginalny rozmiar czcionki. - + + + + + A<sup>↓</sup> + tolowercase + [] + lowercase + + u + 6 + Zamień wielkie litery na małe. + + + + + + Podstawowa + basic_correction + {"exprs": [["\n\\d+\n", "\n"], ["-\\s*\n+", ""], ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."]]} + fulltextregexp + + + 0 + Wykonuję operację z novel-pages i poem-pages. + + + + + + Usuń spację + strip_whitespace + {"exprs": [["^\\s+|\\s+$", ""], ["\\s+", " "]]} + lineregexp + + + 0 + Usuwa zbędne spację z dokumentu. + + + + + + Wers wcięty + wers-wciety + {"tag": "wers_wciety", "attrs": {"typ": ""}} + insert_tag + + + 0 + + + + + + + + Wydrukuj + print-xml + [] + + + + print/xml + + 0 + + + + + + + Wydrukuj + htmleditor-print + [] + + + + print/html + + 0 + + + + + + + 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 + + + 0 + + + + + + + Zamień dywiz + zamien_dywiz + {"exprs": [["(\\d)[\u2014-](\\d)", "$1--$2"], ["\u2014", "---"]]} + lineregexp + + + 0 + Zamienia '—' na '---', oraz '1—2' na '1--2'. + + akapit akapit - ({tag:"akap"}) + {"tag": "akap"} insert_tag + + 0 @@ -127,9 +234,11 @@ akapit cd. akapit-cd - ({tag:"akap_cd"}) + {"tag": "akap_cd"} insert_tag + + 0 @@ -138,9 +247,11 @@ akapit dialogowy akapit-dialogowy - ({tag:"akap_dialog"}) + {"tag": "akap_dialog"} insert_tag + + 0 @@ -149,9 +260,11 @@ akt akt - ({tag:"akt"}) + {"tag": "akt"} insert_tag + + 0 @@ -160,9 +273,11 @@ autor autor - ({tag:"autor"}) + {"tag": "autor"} insert_tag + + 0 @@ -171,86 +286,79 @@ część/księga czesc - ({tag:"naglowek_czesc"}) + {"tag": "naglowek_czesc"} insert_tag + + 0 - - dedykacja - dedykacja - ({tag:"dedykacja"}) - insert_tag - - - - - - dedykacja dedykacja - ({tag:"dedykacja"}) + {"tag": "dedykacja"} insert_tag + + 0 + - - didaskalia - didaskalia - ({tag:"didaskalia"}) - insert_tag - - - - - - didaskalia didaskalia - ({tag:"didaskalia"}) + {"tag": "didaskalia"} insert_tag + + 0 + - - didaskalia wewn. - didaskalia-wewn - ({tag:"didask_tekst"}) + + didaskalia początkowe + didaskalia-poczatkowe + {"tag": "miejsce_czas"} insert_tag + + 0 - + didaskalia wewn. didaskalia-wewn - ({tag:"didask_tekst"}) + {"tag": "didask_tekst"} insert_tag + + 0 + dramat wiersz. dramat-wiersz - ({tag:"dramat_wierszowany_l"}) + {"tag": "dramat_wierszowany_l"} insert_tag + + 0 @@ -259,9 +367,11 @@ dramat wiersz./w. łam dramat-wiersz-w-lam - ({tag:"dramat_wierszowany_lp"}) + {"tag": "dramat_wierszowany_lp"} insert_tag + + 0 @@ -270,9 +380,11 @@ dramat współczesny dramat-wspolczesny - ({tag:"dramat_wspolczesny"}) + {"tag": "dramat_wspolczesny"} insert_tag + + 0 @@ -281,9 +393,11 @@ dzieło nadrzędne dzielo-nadrzedne - ({tag:"dzielo_nadrzedne"}) + {"tag": "dzielo_nadrzedne"} insert_tag + + 0 @@ -292,86 +406,66 @@ długi cyt. poet. dlugi-cyt-poet - ({tag:"poezja_cyt"}) - insert_tag - - - - - - - - długi cyta. poet. - dlugi-cyt-poet - ({tag:"poezja_cyt"}) + {"tag": "poezja_cyt"} insert_tag + + 0 + długi cytat dlugi-cytat - ({tag:"dlugi_cyt"}) + {"tag": "dlugi_cyt"} insert_tag + + 0 - - - - długi cytat - dlugi-cytat - dlugi_cytat - insert_tag - - - ekstra ekstra - ({tag:"ekstra"}) + {"tag": "ekstra"} insert_tag + + 0 - + kwestia kwestia - ({tag:"kwestia"}) + {"tag": "kwestia"} insert_tag + + 0 - - - - kwestia - kwestia - ({tag:"kwestia"}) - insert_tag - - - liryka liryka - ({tag:"liryka_l"}) + {"tag": "liryka_l"} insert_tag + + 0 @@ -380,53 +474,64 @@ liryka/w. łam liryka-w-lam - ({tag:"liryka_lp"}) + {"tag": "liryka_lp"} insert_tag + + 0 - - mamtemat. - matemat - ({tag:"mat"}) + + lista osób: pole + lista-osob-pole + {"tag": "lista_osoba", "attrs": {"typ": ""}} insert_tag + + 0 - + - - motto - motto - ({tag:"motto"}) + + mamtemat. + matemat + {"tag": "mat"} insert_tag + + 0 - + motto motto - ({tag:"motto"}) + {"tag": "motto"} insert_tag + + 0 + motto podpis motto-podpis - ({tag:"motto_podpis"}) + {"tag": "motto_podpis"} insert_tag + + 0 @@ -435,9 +540,11 @@ nagłówek kwestii naglowek-kwestii - ({tag:"naglowek_osoba"}) + {"tag": "naglowek_osoba"} insert_tag + + 0 @@ -446,70 +553,51 @@ nota nota - ({tag:"nota"}) + {"tag": "nota"} insert_tag + + 0 - - Novelpages - novelpages - ({exprs: [ - - ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."], - - ["„", ",,"] /* DOUBLE LOW-9 QUOTATION MARK */ - -]}) - lineregexp - - Wykonuję operację z novel-pages. - - - - opowiadanie opowiadanie - ({tag:"opowiadanie"}) + {"tag": "opowiadanie"} insert_tag + + 0 - - osoba - osoba - ({tag:"osoba"}) - insert_tag - - - - - - osoba osoba - ({tag:"osoba"}) + {"tag": "osoba"} insert_tag + + 0 + podrozdział podrozdzial - ({tag:"naglowek_podrozdzial"}) + {"tag": "naglowek_podrozdzial"} insert_tag + + 0 @@ -518,9 +606,11 @@ podtytuł podtytul - ({tag:"podtytul"}) + {"tag": "podtytul"} insert_tag + + 0 @@ -529,9 +619,11 @@ powieść powiesc - ({tag:"powiesc"}) + {"tag": "powiesc"} insert_tag + + 0 @@ -540,9 +632,11 @@ przypis autorski przypis-autorski - ({tag:"pa"}) + {"tag": "pa"} insert_tag + + 0 @@ -551,9 +645,11 @@ przypis edytorski przypis-edytorski - ({tag:"pe"}) + {"tag": "pe"} insert_tag + + 0 @@ -562,9 +658,11 @@ przypis redaktorski przypis-redaktorski - ({tag:"pr"}) + {"tag": "pr"} insert_tag + + 0 @@ -573,9 +671,11 @@ przypis tłumacza przypis-tlumacza - ({tag:"pt"}) + {"tag": "pt"} insert_tag + + 0 @@ -584,9 +684,11 @@ rozdział rozdzial - ({tag:"naglowek_rozdzial"}) + {"tag": "naglowek_rozdzial"} insert_tag + + 0 @@ -595,9 +697,11 @@ scena scena - ({tag:"naglowek_scena"}) + {"tag": "naglowek_scena"} insert_tag + + 0 @@ -606,9 +710,11 @@ sep. asteryks sep-asteryks - ({tag:"sekcja_asteryks"}) + {"tag": "sekcja_asteryks"} insert_tag + + 0 @@ -617,9 +723,11 @@ sep. linia sep-linia - ({tag:"separator_linia"}) + {"tag": "separator_linia"} insert_tag + + 0 @@ -628,53 +736,38 @@ sep. światło sep-swiatlo - ({tag:"sekcja_swiatlo"}) + {"tag": "sekcja_swiatlo"} insert_tag + + 0 - - śródtytuł - srodtytul - ({tag:"srodtytul"}) - insert_tag - - - - - - - + strofa strofa - ({tag"strofa"}) - insert_tag - + {"tag": "strofa"} + insert_stanza + + s + 1 - - - - strofa - strofa - ({tag:"strofa"}) - insert_tag - - - słowo obce slowo-obce - ({tag:"slowo_obce"}) + {"tag": "slowo_obce"} insert_tag + + 0 @@ -683,9 +776,11 @@ tagi główne tagi-glowne - ({tag:"utwor"}) + {"tag": "utwor"} insert_tag + + 0 @@ -694,9 +789,11 @@ tytuł tytul - ({tag:"nazwa_utworu"}) + {"tag": "nazwa_utworu"} insert_tag + + 0 @@ -705,108 +802,65 @@ tytuł dzieła tytul-dziela - ({tag:"tytul_dziela"}) + {"tag": "tytul_dziela", "attrs": {"typ": "1"}} insert_tag + + 0 - - Usuń spację - strip_whitespace - ({exprs: [ ["^\\s+|\\s+$", ""], ["\\s+", " "] ]}) - lineregexp - - Usuwa zbędne spację z dokumentu. - - - - uwaga uwaga - ({tag:"uwaga"}) + {"tag": "uwaga"} insert_tag + + 0 - + wers akap. wers-akap - ({tag:"wers_akap"}) + {"tag": "wers_akap"} insert_tag + + 0 - - - - wers akap. - wers-akap - ({tag:"wers_akap"}) - insert_tag - - - - + wers cd. wers-cd - ({tag:"wers_cd"}) + {"tag": "wers_cd"} insert_tag + + 0 - - - - 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"}) + {"tag": "www"} insert_tag + + 0 @@ -815,9 +869,11 @@ wyróżnienie wyroznienie - ({tag:"wyroznienie"}) + {"tag": "wyroznienie"} insert_tag + + 0 @@ -826,9 +882,11 @@ wywiad wywiad - ({tag:"wywiad"}) + {"tag": "wywiad"} insert_tag + + 0 @@ -837,9 +895,11 @@ wywiad odpowiedź wywiad-odpowiedz - ({tag:"wywiad_odp"}) + {"tag": "wywiad_odp"} insert_tag + + 0 @@ -848,50 +908,68 @@ wywiad pytanie wywiad-pytanie - ({tag:"wywiad_pyt"}) + {"tag": "wywiad_pyt"} insert_tag + + 0 - - Zamień dywiz - zamien_dywiz - ({exprs:[ ["—","---"] ]}) - lineregexp - - Zamienia '—' na '---'. - - - - zastępnik wersu zastepnik-wersu - ({tag:"zastepnik_wersu"}) + {"tag": "zastepnik_wersu"} insert_tag + + 0 + + śródtytuł + srodtytul + {"tag": "srodtytul"} + insert_tag + + + 0 + + + + + - $.log(editor, panel, params); + var texteditor = panel.texteditor; +var text = texteditor.selection(); +var out = '<'+params.tag; -var texteditor = panel.texteditor; +for (var attr in params.attrs) { -var text = texteditor.selection(); + out += ' '+attr+'="' + params.attrs[attr] + '"'; -texteditor.replaceSelection('<' + params.tag + '>' + text + '</' + params.tag + '>'); +}; + +out += '>'; + +out += text; + +out += '</' + params.tag + '>'; + + + +texteditor.replaceSelection(out); -if (text.length == 0) -{ + +if (text.length == 0) { var pos = texteditor.cursorPosition(); @@ -904,57 +982,72 @@ if (text.length == 0) panel.fireEvent('contentChanged'); - // params: {exprs: list of {expr: "", repl: "" [, opts: "g"]}} -var cm = panel.texteditor; + editor.showPopup('generic-info', 'Przetwarzanie zaznaczonego tekstu...', '', -1); +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 changed = false; - var lines = selection.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; + +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 = 0; +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(changed) { - cm.replaceSelection( lines.join('\n') ); - panel.fireEvent('contentChanged'); - } + if(old_line != line) changed += 1; + return line; +}); + +if(changed > 0) +{ + cm.replaceSelection( lines.join('\n') ); + panel.fireEvent('contentChanged'); + editor.showPopup('generic-yes', 'Zmieniono ' + changed + ' linii.', 1500); + editor.advancePopupQueue(); } else { - var line = cm.firstLine(); - var hasChanges = false; - do { - var content = cm.lineContent(line); - var old_content = content; - $(exprs).each(function() { var expr = this; - content = content.replace(expr.rx, expr.repl); - }); - - if(old_content != content) { - cm.setLineContent(line, content); - hasChanges = true; - } - - line = cm.nextLine(line); - } while( !(line === false) ); - - if(hasChanges) panel.fireEvent('contentChanged'); -} + editor.showPopup('generic-info', 'Brak zmian w tekście', 1500); + editor.advancePopupQueue(); +} + +if(!partial) + cm.selectLines( cm.nthLine(cpos.line), cpos.character ) var texteditor = panel.texteditor; @@ -977,4 +1070,111 @@ else { } + + editor.showPopup('generic-info', 'Przetwarzanie zaznaczonego tekstu...', '', -1); + +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'); + editor.showPopup('generic-yes', 'Zmieniono tekst' ); + editor.advancePopupQueue(); +} +else { + editor.showPopup('generic-info', 'Brak zmian w tekście.'); + editor.advancePopupQueue(); +} + +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'); + +}; + + + var texteditor = panel.texteditor; + +var text = texteditor.selection(); + + + +if(text) { + + text = '\n' + text.split('\n').join('\\\n') + '\n'; + +} + + + +texteditor.replaceSelection('<strofa>'+text+'</strofa>'); + + + +if (!text) { + + var pos = texteditor.cursorPosition(); + + texteditor.selectLines(pos.line, pos.character + 6 + 2); + +} + + + + + + + +panel.fireEvent('contentChanged'); +