本文整理匯總了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),
})