self._properties = properties self._lexer = find_lexer_module_by_id(SCLEX_SQL) self._keyword_lists = [ WordList(Keywords.sql_keywords), ] class SQLHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_C') class SQLHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, SQLHandler): name = 'sql' description = 'SQL' def __init__(self): SQLHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_C') def generate_html(self, file, buffer, lexer=SQLLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) sql_language_info = LanguageInfo.LanguageInfo('sql', ['sql'], [], [SQLHTMLGenerator]) LanguageInfo.register_language(sql_language_info)
WordList(Keywords.postscript_level3_keywords), WordList(Keywords.postscript_ripspecific_keywords), WordList(), ] class PostScriptHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, "SCE_PS") class PostScriptHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, PostScriptHandler): name = "ps" description = "PostScript" def __init__(self): PostScriptHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, "SCE_PS") def generate_html(self, file, buffer, lexer=PostScriptLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) postscript_language_info = LanguageInfo.LanguageInfo( "PostScript", ["ps", "eps", "postscript"], [".*?PS-.*?"], [PostScriptHTMLGenerator] ) LanguageInfo.register_language(postscript_language_info)
WordList(Keywords.java_keywords), WordList(), # User defined (important functions, constants, etc.) WordList(Keywords.javadoc_keywords), WordList(), # "Fold header keywords" - whatever that is WordList(), # Global classes and typedefs ] class JavaHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_C') class JavaHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, JavaHandler): name = 'java' description = 'Java' def __init__(self): JavaHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_C') def generate_html(self, file, buffer, lexer=JavaLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) java_language_info = LanguageInfo.LanguageInfo('Java', ['java'], [], [JavaHTMLGenerator]) LanguageInfo.register_language(java_language_info)
WordList(Keywords.vb_keywords), WordList(Keywords.python_keywords), WordList(Keywords.php_keywords), WordList(Keywords.sgml_keywords) ] class XSLTHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_H') class XSLTHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, XSLTHandler): name = 'xslt' description = 'XSLT' def __init__(self): XSLTHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_H') def generate_html(self, file, buffer, lexer=XSLTLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) xslt_language_info = LanguageInfo.LanguageInfo('xslt', ['xsl', 'xslt'], [], [XSLTHTMLGenerator]) LanguageInfo.register_language(xslt_language_info)
import _SilverCity from _SilverCity import * def get_default_stylesheet_location(): """get_default_stylesheet_location() => file path Returns the path of the default cascading style sheet (CSS) file that is installed with the rest of the SilverCity package.""" import os css_file = os.path.join(os.path.dirname(__file__), 'default.css') if not os.path.exists(css_file): raise Exception('Default CSS file could not be found at %s' % css_file) return css_file import LanguageInfo LanguageInfo.do_registration()
def __init__(self): PythonHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_P') def handle_p_string(self, text, **ignored): generator = guess_generator(text) if generator is not None: generator.generate_html(self._file, text) else: self.handle_other(text=text, **ignored) def handle_p_character(self, **kwargs): self.handle_p_string(**kwargs) def handle_p_triple(self, **kwargs): self.handle_p_string(**kwargs) def handle_p_tripledouble(self, **kwargs): self.handle_p_string(**kwargs) def handle_p_stringeol(self, **kwargs): self.handle_p_string(**kwargs) python_language_info = LanguageInfo.LanguageInfo( 'python', ['py', 'pyw', 'cgi'], ['.*?python.*?'], [PythonHTMLGenerator, SmartPythonHTMLGenerator]) LanguageInfo.register_language(python_language_info)
WordList(), # "Fold header keywords" - whatever that is WordList(), # Global classes and typedefs ] class JavaHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_C') class JavaHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, JavaHandler): name = 'java' description = 'Java' def __init__(self): JavaHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_C') def generate_html(self, file, buffer, lexer = JavaLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) java_language_info = LanguageInfo.LanguageInfo( 'Java', ['java'], [], [JavaHTMLGenerator] ) LanguageInfo.register_language(java_language_info)
WordList(Keywords.python_keywords), WordList(Keywords.php_keywords), WordList(Keywords.sgml_keywords) ] class XSLTHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_H') class XSLTHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, XSLTHandler): name = 'xslt' description = 'XSLT' def __init__(self): XSLTHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_H') def generate_html(self, file, buffer, lexer = XSLTLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) xslt_language_info = LanguageInfo.LanguageInfo( 'xslt', ['xsl', 'xslt'], [], [XSLTHTMLGenerator] ) LanguageInfo.register_language(xslt_language_info)
self._properties = properties self._lexer = find_lexer_module_by_id(SCLEX_NULL) self._keyword_lists = [] class NULLHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, None) class NULLHTMLGenerator(HTMLGenerator.HTMLGenerator, NULLHandler): name = 'null' description = 'No styling' def __init__(self): NULLHandler.__init__(self) def generate_html(self, file, buffer, lexer=NULLLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) def handle_other(self, style, text, **ignored): self._file.write(self.markup(text)) null_language_info = LanguageInfo.LanguageInfo('null', ['text', 'txt'], [], [NULLHTMLGenerator]) LanguageInfo.register_language(null_language_info)
WordList(),# "User defined tasks and identifiers" WordList(),# "Unused" ] class VerilogHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_V') class VerilogHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, VerilogHandler): name = 'verilog' description = 'verilog' def __init__(self): VerilogHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_V') def generate_html(self, file, buffer, lexer = VerilogLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) verilog_language_info = LanguageInfo.LanguageInfo( 'Verilog', ['v', 'vh', 'sv', 'svh' ], [], [VerilogHTMLGenerator] ) LanguageInfo.register_language(verilog_language_info)
WordList(), WordList(), WordList(Keywords.sgml_keywords) ] class XMLHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_H') class XMLHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, XMLHandler): name = 'xml' description = 'XML' def __init__(self): XMLHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_H') def generate_html(self, file, buffer, lexer=XMLLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) xml_language_info = LanguageInfo.LanguageInfo('xml', ['xml', 'dtd'], [r'.*?\<\?xml.*?'], [XMLHTMLGenerator]) LanguageInfo.register_language(xml_language_info)
class LessLexer(_CSSLexerTemplate): def __init__(self, properties=PropertySet()): _CSSLexerTemplate.__init__(self, properties) properties['lexer.css.less.language'] = '1' class CSSHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_CSS') class CSSHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, CSSHandler): name = 'css' description = 'Cascading Style Sheets' def __init__(self): CSSHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_CSS') def generate_html(self, file, buffer, lexer=CSSLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) css_language_info = LanguageInfo.LanguageInfo('css', ['css'], ['.*?css.*?'], [CSSHTMLGenerator]) LanguageInfo.register_language(css_language_info)
WordList() ] class JavaScriptHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_C') class JavaScriptHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, JavaScriptHandler): name = 'js' description = 'JavaScript' def __init__(self): JavaScriptHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_C') def generate_html(self, file, buffer, lexer=JavaScriptLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) javascript_language_info = LanguageInfo.LanguageInfo( 'JavaScript', ['js', 'javascript'], [], [JavaScriptHTMLGenerator] ) LanguageInfo.register_language(javascript_language_info)
self._lexer = find_lexer_module_by_id(SCLEX_PERL) self._keyword_lists = [ WordList(Keywords.perl_keywords), ] class PerlHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_PL') class PerlHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, PerlHandler): name = 'perl' description = 'Perl' def __init__(self): PerlHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_PL') def generate_html(self, file, buffer, lexer=PerlLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) perl_language_info = LanguageInfo.LanguageInfo('perl', ['pl', 'cgi'], ['.*?perl.*?'], [PerlHTMLGenerator]) LanguageInfo.register_language(perl_language_info)
] class HyperTextHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_H') class HyperTextHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, HyperTextHandler): name = 'html' description = 'HTML and PHP [with embedded: JavaScript, VBScript, Python]' def __init__(self): HyperTextHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_H') def generate_html(self, file, buffer, lexer=HyperTextLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) html_language_info = LanguageInfo.LanguageInfo( 'html', ['html', 'htm', 'xhtml', re.compile('^php(\d)?$', re.IGNORECASE), 'inc'], ['.*?\<!DOCTYPE\s+html'], [HyperTextHTMLGenerator]) LanguageInfo.register_language(html_language_info)
self._properties = properties self._lexer = find_lexer_module_by_id(SCLEX_YAML) self._keyword_lists = [ WordList(Keywords.yaml_keywords), ] class YAMLHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_YAML') class YAMLHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, YAMLHandler): name = 'yaml' description = 'YAML' def __init__(self): YAMLHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_YAML') def generate_html(self, file, buffer, lexer=YAMLLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) yaml_language_info = LanguageInfo.LanguageInfo('YAML', ['yml', 'yaml'], [], [YAMLHTMLGenerator]) LanguageInfo.register_language(yaml_language_info)
] class CPPHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_C') class CPPHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, CPPHandler): name = 'cpp' description = 'C and C++' def __init__(self): CPPHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_C') def generate_html(self, file, buffer, lexer=CPPLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) cpp_language_info = LanguageInfo.LanguageInfo( 'C++', ['c', 'c+', 'c++', 'cpp', 'cxx', 'h', 'hpp'], [], [CPPHTMLGenerator] ) LanguageInfo.register_language(cpp_language_info)
self._lexer = find_lexer_module_by_id(SCLEX_PERL) self._keyword_lists = [ WordList(Keywords.perl_keywords), ] class PerlHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_PL') class PerlHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, PerlHandler): name = 'perl' description = 'Perl' def __init__(self): PerlHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_PL') def generate_html(self, file, buffer, lexer = PerlLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) perl_language_info = LanguageInfo.LanguageInfo( 'perl', ['pl', 'cgi'], ['.*?perl.*?'], [PerlHTMLGenerator] ) LanguageInfo.register_language(perl_language_info)
WordList(), # "System Tasks" WordList(), # "User defined tasks and identifiers" WordList(), # "Unused" ] class VerilogHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_V') class VerilogHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, VerilogHandler): name = 'verilog' description = 'verilog' def __init__(self): VerilogHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_V') def generate_html(self, file, buffer, lexer=VerilogLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) verilog_language_info = LanguageInfo.LanguageInfo('Verilog', ['v', 'vh', 'sv', 'svh'], [], [VerilogHTMLGenerator]) LanguageInfo.register_language(verilog_language_info)
self._lexer = find_lexer_module_by_id(SCLEX_RUBY) self._keyword_lists = [ WordList(Keywords.ruby_keywords) ] class RubyHandler(Python.PythonHandler): pass # This is a hack since we now subclass PythonHandler instead of # RubyHandler class RubyHTMLGenerator(Python.PythonHTMLGenerator): name = 'ruby' description = 'Ruby' def __init__(self): Python.PythonHTMLGenerator.__init__(self) def generate_html(self, file, buffer, lexer = RubyLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) ruby_language_info = LanguageInfo.LanguageInfo( 'ruby', ['rb', 'cgi'], ['.*?ruby.*?'], [RubyHTMLGenerator] ) LanguageInfo.register_language(ruby_language_info)
WordList(), WordList() ] class JavaScriptHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_C') class JavaScriptHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, JavaScriptHandler): name = 'js' description = 'JavaScript' def __init__(self): JavaScriptHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_C') def generate_html(self, file, buffer, lexer=JavaScriptLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) javascript_language_info = LanguageInfo.LanguageInfo('JavaScript', ['js', 'javascript'], [], [JavaScriptHTMLGenerator]) LanguageInfo.register_language(javascript_language_info)
self._lexer = find_lexer_module_by_id(SCLEX_NULL) self._keyword_lists = [] class NULLHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, None) class NULLHTMLGenerator(HTMLGenerator.HTMLGenerator, NULLHandler): name = 'null' description = 'No styling' def __init__(self): NULLHandler.__init__(self) def generate_html(self, file, buffer, lexer = NULLLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) def handle_other(self, style, text, **ignored): self._file.write(self.markup(text)) null_language_info = LanguageInfo.LanguageInfo( 'null', ['text', 'txt'], [], [NULLHTMLGenerator] ) LanguageInfo.register_language(null_language_info)
def __init__(self): PythonHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, "SCE_P") def handle_p_string(self, text, **ignored): generator = guess_generator(text) if generator is not None: generator.generate_html(self._file, text) else: self.handle_other(text=text, **ignored) def handle_p_character(self, **kwargs): self.handle_p_string(**kwargs) def handle_p_triple(self, **kwargs): self.handle_p_string(**kwargs) def handle_p_tripledouble(self, **kwargs): self.handle_p_string(**kwargs) def handle_p_stringeol(self, **kwargs): self.handle_p_string(**kwargs) python_language_info = LanguageInfo.LanguageInfo( "python", ["py", "pyw", "cgi"], [".*?python.*?"], [PythonHTMLGenerator, SmartPythonHTMLGenerator] ) LanguageInfo.register_language(python_language_info)
WordList(), WordList(), WordList(Keywords.sgml_keywords) ] class XMLHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_H') class XMLHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, XMLHandler): name = 'xml' description = 'XML' def __init__(self): XMLHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_H') def generate_html(self, file, buffer, lexer = XMLLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) xml_language_info = LanguageInfo.LanguageInfo( 'xml', ['xml', 'dtd'], [r'.*?\<\?xml.*?'], [XMLHTMLGenerator] ) LanguageInfo.register_language(xml_language_info)
WordList(Keywords.postscript_ripspecific_keywords), WordList() ] class PostScriptHandler(DispatchHandler): def __init__(self): DispatchHandler.__init__(self, 'SCE_PS') class PostScriptHTMLGenerator(HTMLGenerator.SimpleHTMLGenerator, PostScriptHandler): name = 'ps' description = 'PostScript' def __init__(self): PostScriptHandler.__init__(self) HTMLGenerator.SimpleHTMLGenerator.__init__(self, 'SCE_PS') def generate_html(self, file, buffer, lexer=PostScriptLexer()): self._file = file lexer.tokenize_by_style(buffer, self.event_handler) postscript_language_info = LanguageInfo.LanguageInfo( 'PostScript', ['ps', 'eps', 'postscript'], ['.*?PS-.*?'], [PostScriptHTMLGenerator]) LanguageInfo.register_language(postscript_language_info)