X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/d8ac9c9786c906979c58e97b7c6df302c5d32770..fc7a60feb9496c250cd1e8ca3db8c74267790047:/fixtures/przyciski.xml diff --git a/fixtures/przyciski.xml b/fixtures/przyciski.xml old mode 100644 new mode 100755 index a8ad2c19..2065b151 --- a/fixtures/przyciski.xml +++ b/fixtures/przyciski.xml @@ -1,53 +1,1180 @@ - -Autokorektaautokorekta0Formatowanieformatowanie0Novelpagesnovelpages({exprs: [ - ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."], - ["„", ",,"] /* DOUBLE LOW-9 QUOTATION MARK */ -]}) - lineregexpWykonuję operację z novel-pages.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) ); -} + + + + Dodatkowe przyciski w XMLEditor + xmleditor-extra-buttons + -1 + + + HTMLEditor Extra + htmleditor-extra + -1 + + + Akapity i długie cytaty + akapity-i-dlugie-cytaty + 0 + + + Autokorekta + autokorekta + 0 + + + Bloki + bloki + 0 + + + Dramat wierszowany + dramat-wierszowany + 0 + + + Dramat współczesny + dramat-wspolczesny + 0 + + + Elementy początkowe + elementy-poczatkowe + 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 + + + A<sup>+</sup> + increase_font_size + {"change": 2} + codemirror_fontsize + + + 0 + Zwiększ rozmiar czcionki. + + + + + + A<sup>-</sup> + descrease_font_size + {"change": -2} + codemirror_fontsize + + + 0 + Zmniejsz rozmiar czcionki. + + + + + + A<sup>=</sup> + reset_font_size + {"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"} + insert_tag + + + 0 + + + + + + + akapit cd. + akapit-cd + {"tag": "akap_cd"} + insert_tag + + + 0 + + + + + + + akapit dialogowy + akapit-dialogowy + {"tag": "akap_dialog"} + insert_tag + + + 0 + + + + + + + akt + akt + {"tag": "akt"} + insert_tag + + + 0 + + + + + + + autor + autor + {"tag": "autor"} + insert_tag + + + 0 + + + + + + + część/księga + czesc + {"tag": "naglowek_czesc"} + insert_tag + + + 0 + + + + + + + dedykacja + dedykacja + {"tag": "dedykacja"} + insert_tag + + + 0 + + + + + + + + didaskalia + didaskalia + {"tag": "didaskalia"} + insert_tag + + + 0 + + + + + + + + didaskalia początkowe + didaskalia-poczatkowe + {"tag": "miejsce_czas"} + insert_tag + + + 0 + + + + + + + didaskalia wewn. + didaskalia-wewn + {"tag": "didask_tekst"} + insert_tag + + + 0 + + + + + + + + dramat wiersz. + dramat-wiersz + {"tag": "dramat_wierszowany_l"} + insert_tag + + + 0 + + + + + + + dramat wiersz./w. łam + dramat-wiersz-w-lam + {"tag": "dramat_wierszowany_lp"} + insert_tag + + + 0 + + + + + + + dramat współczesny + dramat-wspolczesny + {"tag": "dramat_wspolczesny"} + insert_tag + + + 0 + + + + + + + dzieło nadrzędne + dzielo-nadrzedne + {"tag": "dzielo_nadrzedne"} + insert_tag + + + 0 + + + + + + + długi cyt. poet. + dlugi-cyt-poet + {"tag": "poezja_cyt"} + insert_tag + + + 0 + + + + + + + + długi cytat + dlugi-cytat + {"tag": "dlugi_cyt"} + insert_tag + + + 0 + + + + + + + + ekstra + ekstra + {"tag": "ekstra"} + insert_tag + + + 0 + + + + + + + kwestia + kwestia + {"tag": "kwestia"} + insert_tag + + + 0 + + + + + + + + liryka + liryka + {"tag": "liryka_l"} + insert_tag + + + 0 + + + + + + + liryka/w. łam + liryka-w-lam + {"tag": "liryka_lp"} + insert_tag + + + 0 + + + + + + + lista osób: pole + lista-osob-pole + {"tag": "lista_osoba", "attrs": {"typ": ""}} + insert_tag + + + 0 + + + + + + + mamtemat. + matemat + {"tag": "mat"} + insert_tag + + + 0 + + + + + + + motto + motto + {"tag": "motto"} + insert_tag + + + 0 + + + + + + + + motto podpis + motto-podpis + {"tag": "motto_podpis"} + insert_tag + + + 0 + + + + + + + nagłówek kwestii + naglowek-kwestii + {"tag": "naglowek_osoba"} + insert_tag + + + 0 + + + + + + + nota + nota + {"tag": "nota"} + insert_tag + + + 0 + + + + + + + opowiadanie + opowiadanie + {"tag": "opowiadanie"} + insert_tag + + + 0 + + + + + + + osoba + osoba + {"tag": "osoba"} + insert_tag + + + 0 + + + + + + + + podrozdział + podrozdzial + {"tag": "naglowek_podrozdzial"} + insert_tag + + + 0 + + + + + + + podtytuł + podtytul + {"tag": "podtytul"} + insert_tag + + + 0 + + + + + + + powieść + powiesc + {"tag": "powiesc"} + insert_tag + + + 0 + + + + + + + przypis autorski + przypis-autorski + {"tag": "pa"} + insert_tag + + + 0 + + + + + + + przypis edytorski + przypis-edytorski + {"tag": "pe"} + insert_tag + + + 0 + + + + + + + przypis redaktorski + przypis-redaktorski + {"tag": "pr"} + insert_tag + + + 0 + + + + + + + przypis tłumacza + przypis-tlumacza + {"tag": "pt"} + insert_tag + + + 0 + + + + + + + rozdział + rozdzial + {"tag": "naglowek_rozdzial"} + insert_tag + + + 0 + + + + + + + scena + scena + {"tag": "naglowek_scena"} + insert_tag + + + 0 + + + + + + + sep. asteryks + sep-asteryks + {"tag": "sekcja_asteryks"} + insert_tag + + + 0 + + + + + + + sep. linia + sep-linia + {"tag": "separator_linia"} + insert_tag + + + 0 + + + + + + + sep. światło + sep-swiatlo + {"tag": "sekcja_swiatlo"} + insert_tag + + + 0 + + + + + + + strofa + strofa + {"tag": "strofa"} + insert_stanza + + s + 1 + + + + + + + + słowo obce + slowo-obce + {"tag": "slowo_obce"} + insert_tag + + + 0 + + + + + + + tagi główne + tagi-glowne + {"tag": "utwor"} + insert_tag + + + 0 + + + + + + + tytuł + tytul + {"tag": "nazwa_utworu"} + insert_tag + + + 0 + + + + + + + tytuł dzieła + tytul-dziela + {"tag": "tytul_dziela", "attrs": {"typ": "1"}} + insert_tag + + + 0 + + + + + + + uwaga + uwaga + {"tag": "uwaga"} + insert_tag + + + 0 + + + + + + + wers akap. + wers-akap + {"tag": "wers_akap"} + insert_tag + + + 0 + + + + + + + + wers cd. + wers-cd + {"tag": "wers_cd"} + insert_tag + + + 0 + + + + + + + + www + www + {"tag": "www"} + insert_tag + + + 0 + + + + + + + wyróżnienie + wyroznienie + {"tag": "wyroznienie"} + insert_tag + + + 0 + + + + + + + wywiad + wywiad + {"tag": "wywiad"} + insert_tag + + + 0 + + + + + + + wywiad odpowiedź + wywiad-odpowiedz + {"tag": "wywiad_odp"} + insert_tag + + + 0 + + + + + + + wywiad pytanie + wywiad-pytanie + {"tag": "wywiad_pyt"} + insert_tag + + + 0 + + + + + + + zastępnik wersu + zastepnik-wersu + {"tag": "zastepnik_wersu"} + insert_tag + + + 0 + + + + + + + śródtytuł + srodtytul + {"tag": "srodtytul"} + insert_tag + + + 0 + + + + + + + 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'); + + + 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 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(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 { + 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; + +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) ); + +} + + + 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'); + +