Vergleich admin/jscripts/codemirror/mode/xml/xml.js - 1.8.5 - 1.8.30

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
})(function(CodeMirror) {
"use strict";


})(function(CodeMirror) {
"use strict";


CodeMirror.defineMode("xml", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;
var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag;
if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true;





























var htmlConfig = {
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
'track': true, 'wbr': true, 'menuitem': true},
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
'th': true, 'tr': true},
contextGrabbers: {
'dd': {'dd': true, 'dt': true},
'dt': {'dd': true, 'dt': true},
'li': {'li': true},
'option': {'option': true, 'optgroup': true},
'optgroup': {'optgroup': true},
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
'rp': {'rp': true, 'rt': true},
'rt': {'rp': true, 'rt': true},
'tbody': {'tbody': true, 'tfoot': true},
'td': {'td': true, 'th': true},
'tfoot': {'tbody': true},
'th': {'td': true, 'th': true},
'thead': {'tbody': true, 'tfoot': true},
'tr': {'tr': true}
},
doNotIndent: {"pre": true},
allowUnquoted: true,
allowMissing: true,
caseFold: true
}





  var Kludges = parserConfig.htmlMode ? {
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
'track': true, 'wbr': true, 'menuitem': true},
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
'th': true, 'tr': true},
contextGrabbers: {
'dd': {'dd': true, 'dt': true},
'dt': {'dd': true, 'dt': true},
'li': {'li': true},
'option': {'option': true, 'optgroup': true},
'optgroup': {'optgroup': true},
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
'rp': {'rp': true, 'rt': true},
'rt': {'rp': true, 'rt': true},
'tbody': {'tbody': true, 'tfoot': true},
'td': {'td': true, 'th': true},
'tfoot': {'tbody': true},
'th': {'td': true, 'th': true},
'thead': {'tbody': true, 'tfoot': true},
'tr': {'tr': true}
},
doNotIndent: {"pre": true},
allowUnquoted: true,
allowMissing: true,
caseFold: true
} : {
autoSelfClosers: {},
implicitlyClosed: {},
contextGrabbers: {},
doNotIndent: {},
allowUnquoted: false,
allowMissing: false,
caseFold: false
};
var alignCDATA = parserConfig.alignCDATA;

var xmlConfig = {
autoSelfClosers: {},
implicitlyClosed: {},
contextGrabbers: {},
doNotIndent: {},
allowUnquoted: false,
allowMissing: false,
caseFold: false
}

CodeMirror.defineMode("xml", function(editorConf, config_) {
var indentUnit = editorConf.indentUnit
var config = {}
var defaults = config_.htmlMode ? htmlConfig : xmlConfig
for (var prop in defaults) config[prop] = defaults[prop]
for (var prop in config_) config[prop] = config_[prop]




























// Return variables for tokenizers
var type, setStyle;


// Return variables for tokenizers
var type, setStyle;

Zeile 109Zeile 111
      return null;
}
}

      return null;
}
}

 
  inText.isInText = true;


function inTag(stream, state) {
var ch = stream.next();


function inTag(stream, state) {
var ch = stream.next();

Zeile 187Zeile 190
    this.tagName = tagName;
this.indent = state.indented;
this.startOfLine = startOfLine;

    this.tagName = tagName;
this.indent = state.indented;
this.startOfLine = startOfLine;

    if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))

    if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))

      this.noIndent = true;
}
function popContext(state) {

      this.noIndent = true;
}
function popContext(state) {

Zeile 200Zeile 203
        return;
}
parentTagName = state.context.tagName;

        return;
}
parentTagName = state.context.tagName;

      if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {

      if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
!config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {

        return;
}
popContext(state);

        return;
}
popContext(state);

    }
}

    }
}


function baseState(type, stream, state) {
if (type == "openTag") {
state.tagStart = stream.column();


function baseState(type, stream, state) {
if (type == "openTag") {
state.tagStart = stream.column();

      return tagNameState;

      return tagNameState;

    } else if (type == "closeTag") {
return closeTagNameState;
} else {
return baseState;

    } else if (type == "closeTag") {
return closeTagNameState;
} else {
return baseState;

    }

    }

  }
function tagNameState(type, stream, state) {
if (type == "word") {

  }
function tagNameState(type, stream, state) {
if (type == "word") {

Zeile 232Zeile 235
    if (type == "word") {
var tagName = stream.current();
if (state.context && state.context.tagName != tagName &&

    if (type == "word") {
var tagName = stream.current();
if (state.context && state.context.tagName != tagName &&

          Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName))

          config.implicitlyClosed.hasOwnProperty(state.context.tagName))

        popContext(state);

        popContext(state);

      if (state.context && state.context.tagName == tagName) {

      if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {

        setStyle = "tag";
return closeState;
} else {

        setStyle = "tag";
return closeState;
} else {

Zeile 244Zeile 247
    } else {
setStyle = "error";
return closeStateErr;

    } else {
setStyle = "error";
return closeStateErr;

    }
}

    }
}


function closeState(type, _stream, state) {
if (type != "endTag") {


function closeState(type, _stream, state) {
if (type != "endTag") {

Zeile 254Zeile 257
    }
popContext(state);
return baseState;

    }
popContext(state);
return baseState;

  }

  }

  function closeStateErr(type, stream, state) {
setStyle = "error";
return closeState(type, stream, state);

  function closeStateErr(type, stream, state) {
setStyle = "error";
return closeState(type, stream, state);

Zeile 268Zeile 271
      var tagName = state.tagName, tagStart = state.tagStart;
state.tagName = state.tagStart = null;
if (type == "selfcloseTag" ||

      var tagName = state.tagName, tagStart = state.tagStart;
state.tagName = state.tagStart = null;
if (type == "selfcloseTag" ||

          Kludges.autoSelfClosers.hasOwnProperty(tagName)) {
maybePopContext(state, tagName);

          config.autoSelfClosers.hasOwnProperty(tagName)) {
maybePopContext(state, tagName);

      } else {
maybePopContext(state, tagName);
state.context = new Context(state, tagName, tagStart == state.indented);

      } else {
maybePopContext(state, tagName);
state.context = new Context(state, tagName, tagStart == state.indented);

Zeile 281Zeile 284
  }
function attrEqState(type, stream, state) {
if (type == "equals") return attrValueState;

  }
function attrEqState(type, stream, state) {
if (type == "equals") return attrValueState;

    if (!Kludges.allowMissing) setStyle = "error";
return attrState(type, stream, state);
}

    if (!config.allowMissing) setStyle = "error";
return attrState(type, stream, state);
}

  function attrValueState(type, stream, state) {
if (type == "string") return attrContinuedState;

  function attrValueState(type, stream, state) {
if (type == "string") return attrContinuedState;

    if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;}

    if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}

    setStyle = "error";
return attrState(type, stream, state);
}

    setStyle = "error";
return attrState(type, stream, state);
}

Zeile 296Zeile 299
  }

return {

  }

return {

    startState: function() {
return {tokenize: inText,
state: baseState,
indented: 0,
tagName: null, tagStart: null,
context: null};



    startState: function(baseIndent) {
var state = {tokenize: inText,
state: baseState,
indented: baseIndent || 0,
tagName: null, tagStart: null,
context: null}
if (baseIndent != null) state.baseIndent = baseIndent
return state

    },

token: function(stream, state) {

    },

token: function(stream, state) {

Zeile 334Zeile 339
        return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
// Indent the starts of attribute names.
if (state.tagName) {

        return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
// Indent the starts of attribute names.
if (state.tagName) {

        if (multilineTagIndentPastTag)

        if (config.multilineTagIndentPastTag !== false)

          return state.tagStart + state.tagName.length + 2;
else

          return state.tagStart + state.tagName.length + 2;
else

          return state.tagStart + indentUnit * multilineTagIndentFactor;

          return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);

      }

      }

      if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;

      if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;

      var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
if (tagAfter && tagAfter[1]) { // Closing tag spotted
while (context) {
if (context.tagName == tagAfter[2]) {
context = context.prev;
break;

      var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
if (tagAfter && tagAfter[1]) { // Closing tag spotted
while (context) {
if (context.tagName == tagAfter[2]) {
context = context.prev;
break;

          } else if (Kludges.implicitlyClosed.hasOwnProperty(context.tagName)) {

          } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {

            context = context.prev;
} else {
break;

            context = context.prev;
} else {
break;

Zeile 354Zeile 359
        }
} else if (tagAfter) { // Opening tag spotted
while (context) {

        }
} else if (tagAfter) { // Opening tag spotted
while (context) {

          var grabbers = Kludges.contextGrabbers[context.tagName];

          var grabbers = config.contextGrabbers[context.tagName];

          if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
context = context.prev;
else
break;
}
}

          if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
context = context.prev;
else
break;
}
}

      while (context && !context.startOfLine)

      while (context && context.prev && !context.startOfLine)

        context = context.prev;
if (context) return context.indent + indentUnit;

        context = context.prev;
if (context) return context.indent + indentUnit;

      else return 0;

      else return state.baseIndent || 0;

    },

electricInput: /<\/[\s\w:]+>$/,
blockCommentStart: "<!--",
blockCommentEnd: "-->",


    },

electricInput: /<\/[\s\w:]+>$/,
blockCommentStart: "<!--",
blockCommentEnd: "-->",


    configuration: parserConfig.htmlMode ? "html" : "xml",
helperType: parserConfig.htmlMode ? "html" : "xml"






    configuration: config.htmlMode ? "html" : "xml",
helperType: config.htmlMode ? "html" : "xml",

skipAttribute: function(state) {
if (state.state == attrValueState)
state.state = attrState
}

  };
});


  };
});