Python pygments.token.Name.Tag() Examples

The following are 4 code examples of pygments.token.Name.Tag(). 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.token.Name , or try the search function .
Example #1
Source File: email.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def get_x_header_tokens(self, match):
        if self.highlight_x:
            # field
            yield match.start(1), Name.Tag, match.group(1)

            # content
            default_actions = self.get_tokens_unprocessed(
                match.group(2), stack=("root", "header"))
            for item in default_actions:
                yield item
        else:
            # lowlight
            yield match.start(1), Comment.Special, match.group(1)
            yield match.start(2), Comment.Multiline, match.group(2) 
Example #2
Source File: mime.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def get_header_tokens(self, match):
        field = match.group(1)

        if field.lower() in self.attention_headers:
            yield match.start(1), Name.Tag, field + ":"
            yield match.start(2), Text.Whitespace, match.group(2)

            pos = match.end(2)
            body = match.group(3)
            for i, t, v in self.get_tokens_unprocessed(body, ("root", field.lower())):
                yield pos + i, t, v

        else:
            yield match.start(), Comment, match.group() 
Example #3
Source File: email.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def get_x_header_tokens(self, match):
        if self.highlight_x:
            # field
            yield match.start(1), Name.Tag, match.group(1)

            # content
            default_actions = self.get_tokens_unprocessed(
                match.group(2), stack=("root", "header"))
            for item in default_actions:
                yield item
        else:
            # lowlight
            yield match.start(1), Comment.Special, match.group(1)
            yield match.start(2), Comment.Multiline, match.group(2) 
Example #4
Source File: mime.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def get_header_tokens(self, match):
        field = match.group(1)

        if field.lower() in self.attention_headers:
            yield match.start(1), Name.Tag, field + ":"
            yield match.start(2), Text.Whitespace, match.group(2)

            pos = match.end(2)
            body = match.group(3)
            for i, t, v in self.get_tokens_unprocessed(body, ("root", field.lower())):
                yield pos + i, t, v

        else:
            yield match.start(), Comment, match.group()