Edgewall Software

Version 1 (modified by anonymous, 20 years ago) ( diff )

How to add syntax-highlightning to SilverCity that exists in Scintilla

root = where you unpacked SilverCity

lang = the language you want to add

  • Download the latest scintilla. So that you have all the latest lexers. in the SilverCity directory do:

    • tar -xvzf scintillaXXX.tgz
    • python setup.py build
    • cd root/PySilverCity/Src
    • python write_scintilla.py ../../scintilla/include tmp.py
    • rm ../SilverCity/ScintillaConstants.py
    • mv tmp.py ../SilverCity/ScintillaConstants.py
  • Now you change to the root/PySilverCity/SilverCity and have to create a module lang.py

    • cp YAML.py lang.py
    • in lang.py replace every occurance of Yaml with lang
    • change the langue info at the.
      • Change suffixes to what the new lang has.
    • Open root/scintilla/src/Lex'lang' see how many word list arguments are to the function.
      • In lang.py add so many wordlist in self._keywords in the langLexer.__init__ function
        • Check the CPP.py as example.
    • Add the keywords for the language in the Keywords module
    • Add the lang in in the do_registration function in the module LanguageInfo
  • Fix css. So that you get colours when you view the html page.

    • Open root/PySilverCity/SilverCity/ScintillaConstants.py
      • Figure out what the language you added has for lexer keywords, that start with SCE_xx. For example python has SCE_P_something.
    • Add the keywords in root/Scripts/generate_css.py see the other languages as example.
    • cd root/Scripts
    • python generate_css.py >! code.css
  • Add the lang in the root/setup.py script

    • Open root/setup.py
    • Search for py_modules variable and add Scintilla.lang to it
  • Install SilverCity with the new lang.

    • cd root
    • python setup.py install

In Trac

For the syntax-highlightning to take effect you have to add directives for colouring in code.css that normally located in in /usr/share/trac/htdocs/css/code.css. You also have to add the language in the …/trac/mimeviewer/silvercity.py. But se the patch in ticket #602

Note: See TracWiki for help on using the wiki.