Changeset 14637 in spip-zone


Ignore:
Timestamp:
Aug 16, 2007, 1:49:20 PM (13 years ago)
Author:
crichard@…
Message:
  • Nettoyage du code
  • Résolution partielle du problème de Codepress avec IE (plus d'erreur mais toujours pas de coloration syntaxique)
Location:
_plugins_/_stable_/lilyspip/lilyspip_codepress/editeur
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/_stable_/lilyspip/lilyspip_codepress/editeur/codepress/languages/lilypond.js

    r14548 r14637  
    1515        { input : /([rRs][0-9]*\.*) /g, output : '<rest>$1</rest> ' }, //rests
    1616        { input : /(staff-spacing-interface|text-script-interface|Ottava_spanner_engraver|Figured_bass_engraver|Lyrics|Separating_line_group_engraver|cluster-interface|Glissando_engraver|key-signature-interface|clef-interface|VaticanaVoice|Rest_collision_engraver|Grace_engraver|grid-point-interface|Measure_grouping_engraver|Laissez_vibrer_engraver|Script_row_engraver|bass-figure-alignment-interface|Note_head_line_engraver|ottava-bracket-interface|rhythmic-head-interface|Accidental_engraver|Mark_engraver|hara-kiri-group-interface|Instrument_name_engraver|Vaticana_ligature_engraver|Page_turn_engraver|staff-symbol-interface|Beam_performer|accidental-suggestion-interface|Key_engraver|GrandStaff|multi-measure-interface|rest-collision-interface|Dot_column_engraver|MensuralVoice|TabStaff|Pitched_trill_engraver|line-spanner-interface|Time_signature_performer|lyric-interface|StaffGroup|text-interface|slur-interface|Drum_note_performer|TabVoice|measure-grouping-interface|stanza-number-interface|self-alignment-interface|Span_arpeggio_engraver|system-interface|Engraver|RhythmicStaff|font-interface|fret-diagram-interface|Grace_spacing_engraver|Bar_engraver|Dynamic_engraver|Grob_pq_engraver|Default_bar_line_engraver|Swallow_performer|script-column-interface|Piano_pedal_performer|metronome-mark-interface|melody-spanner-interface|FretBoards|spacing-spanner-interface|Control_track_performer|Break_align_engraver|paper-column-interface|PianoStaff|Breathing_sign_engraver|accidental-placement-interface|Tuplet_engraver|stroke-finger-interface|side-position-interface|note-name-interface|bar-line-interface|lyric-extender-interface|Staff|GregorianTranscriptionStaff|Rest_swallow_translator|dynamic-text-spanner-interface|arpeggio-interface|Cluster_spanner_engraver|Collision_engraver|accidental-interface|rest-interface|Tab_note_heads_engraver|dots-interface|staff-symbol-referencer-interface|ambitus-interface|bass-figure-interface|vaticana-ligature-interface|ledgered-interface|item-interface|Tie_performer|volta-bracket-interface|vertically-spaceable-interface|ledger-line-interface|Chord_tremolo_engraver|note-column-interface|DrumVoice|axis-group-interface|Ledger_line_engraver|Slash_repeat_engraver|ligature-bracket-interface|Pitch_squash_engraver|Instrument_switch_engraver|Voice|Script_column_engraver|Volta_engraver|Stanza_number_align_engraver|Vertical_align_engraver|span-bar-interface|Staff_collecting_engraver|Ligature_bracket_engraver|Time_signature_engraver|Beam_engraver|Note_name_engraver|Note_heads_engraver|Forbid_line_break_engraver|spacing-options-interface|spacing-interface|Span_dynamic_performer|piano-pedal-script-interface|MensuralStaff|Global|trill-pitch-accidental-interface|grob-interface|Horizontal_bracket_engraver|Grid_line_span_engraver|NoteNames|piano-pedal-interface|Axis_group_engraver|Staff_symbol_engraver|stem-interface|Slur_engraver|pitched-trill-interface|tie-column-interface|stem-tremolo-interface|Grid_point_engraver|System_start_delimiter_engraver|Completion_heads_engraver|Drum_notes_engraver|Swallow_engraver|Slur_performer|lyric-hyphen-interface|Clef_engraver|dynamic-interface|Output_property_engraver|Score|Repeat_tie_engraver|Rest_engraver|break-aligned-interface|String_number_engraver|only-prebreak-interface|Lyric_engraver|Tempo_performer|Parenthesis_engraver|Repeat_acknowledge_engraver|mensural-ligature-interface|align-interface|Stanza_number_engraver|system-start-delimiter-interface|lyric-syllable-interface|bend-after-interface|dynamic-line-spanner-interface|Staff_performer|Bar_number_engraver|Fretboard_engraver|tablature-interface|Fingering_engraver|chord-name-interface|Note_swallow_translator|Chord_name_engraver|note-head-interface|breathing-sign-interface|Extender_engraver|Ambitus_engraver|DrumStaff|dot-column-interface|Lyric_performer|enclosing-bracket-interface|Trill_spanner_engraver|Key_performer|Vertically_spaced_contexts_engraver|hairpin-interface|Hyphen_engraver|Dots_engraver|multi-measure-rest-interface|break-alignment-align-interface|Multi_measure_rest_engraver|InnerStaffGroup|text-spanner-interface|Grace_beam_engraver|separation-item-interface|Translator|separation-spanner-interface|Tweak_engraver|Devnull|Bend_after_engraver|Spacing_engraver|Piano_pedal_align_engraver|system-start-text-interface|parentheses-interface|Melisma_translator|ChoirStaff|Span_bar_engraver|Text_engraver|GregorianTranscriptionVoice|Timing_translator|script-interface|semi-tie-interface|Percent_repeat_engraver|Tab_staff_symbol_engraver|line-interface|rhythmic-grob-interface|Dynamic_performer|note-spacing-interface|spanner-interface|break-alignment-interface|tuplet-number-interface|Rhythmic_column_engraver|cluster-beacon-interface|horizontal-bracket-interface|Mensural_ligature_engraver|ChordNames|gregorian-ligature-interface|Melody_engraver|ligature-interface|Paper_column_engraver|FiguredBass|grace-spacing-interface|tie-interface|New_fingering_engraver|Script_engraver|Metronome_mark_engraver|string-number-interface|Hara_kiri_engraver|grid-line-interface|Skip_event_swallow_translator|Auto_beam_engraver|spaceable-grob-interface|Font_size_engraver|figured-bass-continuation-interface|semi-tie-column-interface|CueVoice|Phrasing_slur_engraver|InnerChoirStaff|Arpeggio_engraver|mark-interface|VaticanaStaff|piano-pedal-bracket-interface|beam-interface|Note_performer|custos-interface|percent-repeat-interface|time-signature-interface|Custos_engraver|Part_combine_engraver|Piano_pedal_engraver|tuplet-bracket-interface|Stem_engraver|finger-interface|note-collision-interface|Text_spanner_engraver|text-balloon-interface|Tie_engraver|Figured_bass_position_engraver)( |=|<|.)/g, output : '<context>$1</context>$2'}, // Contexts, Engravers, Interfaces (ok, this line could be shorter...)
    17         { input : /\.([a-z|A-Z]+)/g, output : '.<grob>$1</grob>' }, //objects
     17        { input : /\.([a-z|A-Z]+)/g, output : '<grob>$1</grob>' }, //objects
    1818        { input : /([0-9]|breve|longa|maxima)(\.?)/g, output : '<duration>$1</duration>$2' }, // digits and durations
    1919        { input : /\\(override|version|include|invalid|addquote|alternative|book|~|mark|default|key|skip|octave|partial|time|change|consists|remove|accepts|defaultchild|denies|alias|type|description|name|context|grobdescriptions|markup|header|notemode|drummode|figuremode|chordmode|lyricmode|drums|figures|chords|lyrics|once|revert|set|unset|addlyrics|objectid|with|rest|paper|midi|layout|new|times|transpose|tag|relative|renameinput|repeat|lyricsto|score|sequential|simultaneous|longa|breve|maxima|tempo)/g, output : '<command>\\$1</command>' }, // music commands
     
    2121        { input : /\\(acciaccatura|addInstrumentDefinition|addquote|afterGrace|applyContext|applyMusic|applyOutput|appoggiatura|assertBeamQuant|assertBeamSlope|autochange|balloonGrobText|balloonText|bar|barNumberCheck|bendAfter|breathe|clef|compressMusic|cueDuring|displayLilyMusic|displayMusic|featherDurations|grace|includePageLayoutFile|instrumentSwitch|keepWithTag|killCues|makeClusters|musicMap|octave|oldaddlyrics|overrideProperty|parallelMusic|parenthesize|partcombine|pitchedTrill|quoteDuring|removeWithTag|resetRelativeOctave|rightHandFinger|scoreTweak|shiftDurations|spacingTweaks|tag|transposedCueDuring|transposition|tweak|unfoldRepeats|withMusicProperty)/g, output : '<function>\\$1</function>' }, // music functions
    2222        { input : /\\(arrow-head|beam|bigger|bold|box|bracket|bracketed-y-column|caps|center-align|char|circle|column|combine|dir-column|doubleflat|doublesharp|draw-circle|dynamic|epsfile|fill-line|filled-box|finger|flat|fontsize|fraction|fret-diagram|fret-diagram-terse|fret-diagram-verbose|fromproperty|general-align|halign|hbracket|hcenter|hcenter-in|hspace|huge|italic|justify|justify-field|justify-string|large|left-align|line|lookup|lower|magnify|markalphabet|markletter|medium|musicglyph|natural|normal-size-sub|normal-size-super|normal-text|normalsize|note|note-by-number|null|number|on-the-fly|override|pad-around|pad-markup|pad-to-box|pad-x|postscript|put-adjacent|raise|right-align|roman|rotate|sans|score|semiflat|semisharp|sesquiflat|sesquisharp|sharp|simple|slashed-digit|small|smallCaps|smaller|stencil|strut|sub|super|teeny|text|tied-lyric|tiny|translate|translate-scaled|transparent|triangle|typewriter|upright|vcenter|verbatim-file|whiteout|with-color|with-dimensions|with-url|wordwrap|wordwrap-field|wordwrap-string|'|,)( |=|<|.)/g, output : '<mark>\\$1</mark>$2' }, // markup commands
    23         { input : /(#[a-z|A-Z|:|']+) /g, output : '<scheme>$1</scheme> ' }, //scheme
    24         { input : /(#?[\(|'][a-z|A-Z])(.*?)(<br|<\/P)/g, output : '<scheme>$1$2</scheme>$3' }, //scheme
     23        { input : /(#[a-z|A-Z|:|]+) /g, output : '<scheme>$1</scheme>' }, //scheme
     24        { input : /(#?[\(|][a-z|A-Z])(.*?)(<br|<\/P)/g, output : '<scheme>$1$2</scheme>$3' } //scheme
    2525]
    2626
     
    3232Language.shortcuts = [
    3333        { input : '[space]', output : '&nbsp;' },
    34         { input : '[enter]', output : '<br />' } ,
     34        { input : '[enter]', output : '<br />' }
    3535]
  • _plugins_/_stable_/lilyspip/lilyspip_codepress/editeur/lilypond_edit.html

    r14548 r14637  
    2525 <form action="table.html" method="post">
    2626
    27 <textarea id='lilycode'  rows=20 cols=80 class='codepress lilypond linenumbers-on' value='' onchange='recupere_code();' >
     27<textarea id='lilycode'  rows=20 cols=80 class='codepress lilypond linenumbers-on' >
    2828 
    2929</textarea>
  • _plugins_/_stable_/lilyspip/lilyspip_codepress/editeur/lilypress.js

    r14548 r14637  
    11/***********TEMPLATES*******************/
    22
    3 function single_template(){
    4         lilycode.setCode('melody = \\relative c\' { \n\t\\clef treble \n\t\\key c \\major \n\t\\time 4/4 \n\n\ta4 b c d \n\t} \n\n\\score { \n\t\\new Staff \\melody \n\t\\layout {} \n\t\\midi {} \n\t}','lilypond');
    5         //pour activer la coloration syntaxique
    6         lilycode.editor.syntaxHighlight('init');
    7 }
     3        function single_template(){
     4                lilycode.setCode('melody = \\relative c\' { \n\t\\clef treble \n\t\\key c \\major \n\t\\time 4/4 \n\n\ta4 b c d \n\t} \n\n\\score { \n\t\\new Staff \\melody \n\t\\layout {} \n\t\\midi {} \n\t}','lilypond');
     5                //pour activer la coloration syntaxique
     6                lilycode.editor.syntaxHighlight('init');
     7        }
    88   
    9 function piano_template(){
    10         lilycode.setCode('upper = \\relative c\'\' { \n\t\\clef treble \n\t\\key c \\major \n\t\\time 4/4 \n\n\ta b c d \n\t} \n\nlower = \\relative c { \n\t\\clef bass \n\t\\key c \\major \n\t\\time 4/4 \n\n\ta2 c \n\t} \n\n\\score { \n\t\\new PianoStaff << \n\t\t\\new Staff = "upper" \\upper \n\t\t\\new Staff = "lower" \\lower \n\t>> \n\t\\layout {} \n\t\\midi {} \n\t}','lilypond');
    11         //pour activer la coloration syntaxique
    12         lilycode.editor.syntaxHighlight('init');
    13 }
     9        function piano_template(){
     10                lilycode.setCode('upper = \\relative c\'\' { \n\t\\clef treble \n\t\\key c \\major \n\t\\time 4/4 \n\n\ta b c d \n\t} \n\nlower = \\relative c { \n\t\\clef bass \n\t\\key c \\major \n\t\\time 4/4 \n\n\ta2 c \n\t} \n\n\\score { \n\t\\new PianoStaff << \n\t\t\\new Staff = "upper" \\upper \n\t\t\\new Staff = "lower" \\lower \n\t>> \n\t\\layout {} \n\t\\midi {} \n\t}','lilypond');
     11                lilycode.editor.syntaxHighlight('init');
     12        }
    1413
    15 function quartet_template(){
    16         lilycode.setCode('global = { \n\t\\time 4/4 \n\t\\key c \\major \n\t} \n\nviolinOne = \\new Voice { \\relative c\'\'{ \n\t\\set Staff.instrumentName = "Violin 1 " \n\n\tc2 d e1 \\bar "|." \n\t}} \n\nviolinTwo = \\new Voice { \\relative c\'\'{ \n\t\\set Staff.instrumentName = "Violin 2 " \n\n\tg2 f e1 \\bar "|." \n\t}} \n\nviola = \\new Voice { \\relative c\' { \\set Staff.instrumentName = "Viola " \n\t\\clef alto \n\n\te2 d c1 \\bar "|." \n\t}} \n\ncello = \\new Voice { \\relative c\' { \\set Staff.instrumentName = "Cello " \n\t\\clef bass \n\n\tc2 b a1 \\bar "|." \n\t}} \n\n\\score { \n\t\\new StaffGroup << \n\t\t\\new Staff << \\global \\violinOne >> \n\t\t\\new Staff << \\global \\violinTwo >> \n\t\t\\new Staff << \\global \\viola >> \n\t\t\\new Staff << \\global \\cello >> \n\t>> \n\t\\layout {} \n\t\\midi {}\n\t}','lilypond');
    17         //pour activer la coloration syntaxique
    18         lilycode.editor.syntaxHighlight('init');
    19 }
     14        function quartet_template(){
     15                lilycode.setCode('global = { \n\t\\time 4/4 \n\t\\key c \\major \n\t} \n\nviolinOne = \\new Voice { \\relative c\'\'{ \n\t\\set Staff.instrumentName = "Violin 1 " \n\n\tc2 d e1 \\bar "|." \n\t}} \n\nviolinTwo = \\new Voice { \\relative c\'\'{ \n\t\\set Staff.instrumentName = "Violin 2 " \n\n\tg2 f e1 \\bar "|." \n\t}} \n\nviola = \\new Voice { \\relative c\' { \\set Staff.instrumentName = "Viola " \n\t\\clef alto \n\n\te2 d c1 \\bar "|." \n\t}} \n\ncello = \\new Voice { \\relative c\' { \\set Staff.instrumentName = "Cello " \n\t\\clef bass \n\n\tc2 b a1 \\bar "|." \n\t}} \n\n\\score { \n\t\\new StaffGroup << \n\t\t\\new Staff << \\global \\violinOne >> \n\t\t\\new Staff << \\global \\violinTwo >> \n\t\t\\new Staff << \\global \\viola >> \n\t\t\\new Staff << \\global \\cello >> \n\t>> \n\t\\layout {} \n\t\\midi {}\n\t}','lilypond');
     16                lilycode.editor.syntaxHighlight('init');
     17        }
    2018
    21 function vocal_template(){
    22         lilycode.setCode('','lilypond');
    23         //pour activer la coloration syntaxique
    24         lilycode.editor.syntaxHighlight('init');
    25 }
     19        function vocal_template(){
     20                lilycode.setCode('','lilypond');
     21                lilycode.editor.syntaxHighlight('init');
     22        }
    2623   
    2724   
     
    3128 
    3229       
    33                 function selection(zone){
     30        function selection(zone){
    3431                this.s1 = "";
    3532                this.s2 = "";
     
    7471                }
    7572               
    76                 function existe() {return (this.s2!="")} //indique si un tableau SPIP a été sélectionné
     73                function existe() {return (this.s2!="")} //indique si le code lilypond a été sélectionné
    7774        }
    78         var ancien_tableau;
    79 
    80 
    81                
     75       
     76       
     77       
     78        var ancien_code;
    8279       
    8380        function init(){
    8481                   
    85                 ancien_tableau = new selection(top.opener.zone_selection);
    86         theSelection = top.opener.document.getElementById("text_area").value;
     82                ancien_code = new selection(top.opener.zone_selection);
     83                theSelection = top.opener.document.getElementById("text_area").value;
    8784       
    88                 if (ancien_tableau.existe()) {
    89                         //document.write(ancien_tableau.recup_code());
    90                         /* document.getElementById("lilycode").value = ancien_tableau.recup_code() ;    //récupération du titre du tableau
    91                         */
    92                             lilycode.setCode(ancien_tableau.recup_code(),'lilypond') ;
    93                             //pour activer la coloration syntaxique
    94                             lilycode.editor.syntaxHighlight('init');
    95                        
    96                 }
    97 
    98                
     85                if (ancien_code.existe()) {
     86                            lilycode.setCode(ancien_code.recup_code(),'lilypond') ;
     87                            lilycode.editor.syntaxHighlight('init');           
     88                }       
    9989        }
    10090       
    101     function d(s){debug.innerHTML+=s;}
     91        function d(s){debug.innerHTML+=s;}
    10292 
    10393   
    10494
    105 /****génération du code SPIP du tableau ******/
     95/****GENERATION DU CODE LILYPOND ******/
    10696   
    107 function recupere_code(){
    108         lilycode.setCode('toto','lilypond') ;
    109         CodePress.run();
    110 }
     97// l'id du cadre contenant la previsualisation
     98        var outImage="previewField";
     99
     100        function previsualise(adrserver,adrimagevide){
     101
     102                var source=adrserver+'?code='+escape(lilycode.getCode())+'&format=png' ;
     103                var field=document.getElementById(outImage);
     104 
     105                // affichage de l'image vide en attendant le chargement de la partition
     106                field.src=adrimagevide;
     107 
     108                globalPic=new Image();
     109                globalPic.src=source;
     110                field.src=globalPic.src;
     111        }
    111112   
    112113   
    113      function construit_code_lilypond(){
     114        function construit_code_lilypond(){
    114115             
    115         var le_code = lilycode.getCode();
    116         var texte="";
     116                var le_code = lilycode.getCode();
     117                var texte="";
    117118       
    118         texte += "\n<lilypond> \n" + le_code +  "\n<\/lilypond> \n"
     119                texte += "\n<lilypond> \n" + le_code +  "\n<\/lilypond> \n"
    119120       
    120         return texte;   
    121     }
     121                return texte;   
     122        }
    122123       
    123     /**********LES FONCTIONS DE CREATION DE L'INTERFACE**********/
     124 
    124125
    125126        function enregistre(){
    126                 if (ancien_tableau.existe()) {
     127                if (ancien_code.existe()) {
    127128                        if ((clientVer >= 4) && is_ie && is_win) {
    128129                                top.opener.document.selection.createRange().text = construit_code_lilypond();
    129130                        } else {
    130                                 top.opener.zone_selection.value = ancien_tableau.s1 + construit_code_lilypond() + ancien_tableau.s3;
     131                                top.opener.zone_selection.value = ancien_code.s1 + construit_code_lilypond() + ancien_code.s3;
    131132                        }
    132133                } else { //insertion d'un nouveau tableau
     
    136137                                top.opener.zone_selection.focus();
    137138                        } else {
    138                                 top.opener.zone_selection.value = ancien_tableau.s1 + construit_code_lilypond() + ancien_tableau.s3;
     139                                top.opener.zone_selection.value = ancien_code.s1 + construit_code_lilypond() + ancien_code.s3;
    139140                        }
    140141                }
     
    143144       
    144145       
    145          
    146 
    147146
    148147       
    149148       
    150149
    151 // l'id du cadre contenant la previsualisation
    152 var outImage="previewField";
    153150
    154 function previsualise(adrserver,adrimagevide){
    155 
    156         var source=adrserver+'?code='+escape(lilycode.getCode())+'&format=png' ;
    157         var field=document.getElementById(outImage);
    158  
    159         // affichage de l'image vide en attendant le chargement de la partition
    160         field.src=adrimagevide;
    161  
    162         globalPic=new Image();
    163         globalPic.src=source;
    164         field.src=globalPic.src;
    165 
    166 }
    167 
    168 
Note: See TracChangeset for help on using the changeset viewer.