Python pygments.util.looks_like_xml() Examples

The following are 30 code examples of pygments.util.looks_like_xml(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pygments.util , or try the search function .
Example #1
Source File: templates.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        rv = ErbLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #2
Source File: templates.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        rv = SmartyLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #3
Source File: templates.py    From diaphora with GNU Affero General Public License v3.0 5 votes vote down vote up
def analyse_text(text):
        rv = TeaLangLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #4
Source File: templates.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        rv = JavaLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #5
Source File: templates.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        rv = 0.0
        if re.search('val \w+\s*:', text):
            rv += 0.6
        if looks_like_xml(text):
            rv += 0.2
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #6
Source File: templates.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        rv = DjangoLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #7
Source File: templates.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        rv = VelocityLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #8
Source File: html.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        if looks_like_xml(text) and '<xsl' in text:
            return 0.8 
Example #9
Source File: html.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        if looks_like_xml(text):
            return 0.45  # less than HTML 
Example #10
Source File: html.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        if not looks_like_xml(text) and \
           ('<!ELEMENT' in text or '<!ATTLIST' in text or '<!ENTITY' in text):
            return 0.8 
Example #11
Source File: templates.py    From android_universal with MIT License 5 votes vote down vote up
def analyse_text(text):
        rv = ErbLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #12
Source File: templates.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        rv = 0.0
        if re.search(r'val \w+\s*:', text):
            rv += 0.6
        if looks_like_xml(text):
            rv += 0.2
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #13
Source File: templates.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        rv = JavaLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #14
Source File: templates.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        rv = DjangoLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #15
Source File: templates.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        rv = SmartyLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #16
Source File: templates.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        rv = TeaLangLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #17
Source File: templates.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        rv = VelocityLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #18
Source File: html.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        if looks_like_xml(text) and '<xsl' in text:
            return 0.8 
Example #19
Source File: html.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        if looks_like_xml(text):
            return 0.45  # less than HTML 
Example #20
Source File: html.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def analyse_text(text):
        if not looks_like_xml(text) and \
           ('<!ELEMENT' in text or '<!ATTLIST' in text or '<!ENTITY' in text):
            return 0.8 
Example #21
Source File: templates.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        rv = TeaLangLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #22
Source File: templates.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        rv = 0.0
        if re.search(r'val \w+\s*:', text):
            rv += 0.6
        if looks_like_xml(text):
            rv += 0.2
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #23
Source File: templates.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        rv = JavaLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        if '<%' in text and '%>' in text:
            rv += 0.1
        return rv 
Example #24
Source File: templates.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        rv = DjangoLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #25
Source File: templates.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        rv = SmartyLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #26
Source File: templates.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        rv = ErbLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #27
Source File: templates.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        rv = VelocityLexer.analyse_text(text) - 0.01
        if looks_like_xml(text):
            rv += 0.4
        return rv 
Example #28
Source File: html.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        if looks_like_xml(text) and '<xsl' in text:
            return 0.8 
Example #29
Source File: html.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        if looks_like_xml(text):
            return 0.45  # less than HTML 
Example #30
Source File: html.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def analyse_text(text):
        if not looks_like_xml(text) and \
           ('<!ELEMENT' in text or '<!ATTLIST' in text or '<!ENTITY' in text):
            return 0.8