当前位置: 首页>>代码示例>>Python>>正文


Python lexers.BashLexer方法代码示例

本文整理汇总了Python中pygments.lexers.BashLexer方法的典型用法代码示例。如果您正苦于以下问题:Python lexers.BashLexer方法的具体用法?Python lexers.BashLexer怎么用?Python lexers.BashLexer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pygments.lexers的用法示例。


在下文中一共展示了lexers.BashLexer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_attr_renderer

# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import BashLexer [as 别名]
def get_attr_renderer():
    """Return Dictionary containing different Pygements Lexers for Rendering & Highlighting"""
    return {
        'bash_command': lambda x: render(x, lexers.BashLexer),
        'hql': lambda x: render(x, lexers.SqlLexer),
        'sql': lambda x: render(x, lexers.SqlLexer),
        'doc': lambda x: render(x, lexers.TextLexer),
        'doc_json': lambda x: render(x, lexers.JsonLexer),
        'doc_rst': lambda x: render(x, lexers.RstLexer),
        'doc_yaml': lambda x: render(x, lexers.YamlLexer),
        'doc_md': wrapped_markdown,
        'python_callable': lambda x: render(get_python_source(x), lexers.PythonLexer),
    } 
开发者ID:apache,项目名称:airflow,代码行数:15,代码来源:utils.py

示例2: create_lexer

# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import BashLexer [as 别名]
def create_lexer():
    g = create_ipython_grammar()

    return GrammarLexer(
        g,
        lexers={
            "percent": SimpleLexer("class:pygments.operator"),
            "magic": SimpleLexer("class:pygments.keyword"),
            "filename": SimpleLexer("class:pygments.name"),
            "python": PygmentsLexer(PythonLexer),
            "system": PygmentsLexer(BashLexer),
        },
    ) 
开发者ID:prompt-toolkit,项目名称:ptpython,代码行数:15,代码来源:ipython.py

示例3: handle

# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import BashLexer [as 别名]
def handle(self, *args, **options):

        try:
            from pygments import lexers
        except ImportError:
            self.stdout.write("This command requires the Pygments package.")
            self.stdout.write("Please install it with:\n\n")
            self.stdout.write("  pip install Pygments\n\n")
            return

        # Invocation examples
        _process("bash_curl", lexers.BashLexer())
        _process("bash_wget", lexers.BashLexer())
        _process("browser", lexers.JavascriptLexer())
        _process("crontab", lexers.BashLexer())
        _process("cs", lexers.CSharpLexer())
        _process("node", lexers.JavascriptLexer())
        _process("go", lexers.GoLexer())
        _process("python_urllib2", lexers.PythonLexer())
        _process("python_requests", lexers.PythonLexer())
        _process("python_requests_fail", lexers.PythonLexer())
        _process("python_requests_start", lexers.PythonLexer())
        _process("python_requests_payload", lexers.PythonLexer())
        _process("php", lexers.PhpLexer())
        _process("powershell", lexers.shell.PowerShellLexer())
        _process("powershell_inline", lexers.shell.BashLexer())
        _process("ruby", lexers.RubyLexer()) 
开发者ID:healthchecks,项目名称:healthchecks,代码行数:29,代码来源:pygmentize.py

示例4: lexer_bash

# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import BashLexer [as 别名]
def lexer_bash():
    yield BashLexer() 
开发者ID:pygments,项目名称:pygments,代码行数:4,代码来源:test_shell.py

示例5: create_command_lexer

# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import BashLexer [as 别名]
def create_command_lexer():
    """
    Lexer for highlighting of the command line.
    """
    return GrammarLexer(COMMAND_GRAMMAR, lexers={
        'command': SimpleLexer('class:commandline.command'),
        'location': SimpleLexer('class:commandline.location'),
        'shell_command': PygmentsLexer(BashLexer),
    }) 
开发者ID:prompt-toolkit,项目名称:pyvim,代码行数:11,代码来源:lexer.py


注:本文中的pygments.lexers.BashLexer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。