當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。