本文整理汇总了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),
}
示例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),
},
)
示例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())
示例4: lexer_bash
# 需要导入模块: from pygments import lexers [as 别名]
# 或者: from pygments.lexers import BashLexer [as 别名]
def lexer_bash():
yield BashLexer()
示例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),
})