Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 1885 Bytes
1 | To write your own custom highlighter module, you just need to: |
2 | |
3 | # inherit from @Syntax::Convertors::Abstract@ |
4 | # implement the @convert@ method |
5 | |
6 | You can use the @syntax/convertors/html.rb@ file as an example: |
7 | |
8 | {{{lang=ruby,number=true,caption=syntax/convertors/html.rb |
9 | require 'syntax/convertors/abstract' |
10 | |
11 | module Syntax |
12 | module Convertors |
13 | |
14 | # A simple class for converting a text into HTML. |
15 | class HTML < Abstract |
16 | |
17 | # Converts the given text to HTML, using spans to represent token groups |
18 | # of any type but <tt>:normal</tt> (which is always unhighlighted). If |
19 | # +pre+ is +true+, the html is automatically wrapped in pre tags. |
20 | def convert( text, pre=true ) |
21 | html = "" |
22 | html << "<pre>" if pre |
23 | regions = [] |
24 | @tokenizer.tokenize( text ) do |tok| |
25 | value = html_escape(tok) |
26 | case tok.instruction |
27 | when :region_close then |
28 | regions.pop |
29 | html << "</span>" |
30 | when :region_open then |
31 | regions.push tok.group |
32 | html << "<span class=\"#{tok.group}\">#{value}" |
33 | else |
34 | if tok.group == ( regions.last || :normal ) |
35 | html << value |
36 | else |
37 | html << "<span class=\"#{tok.group}\">#{value}</span>" |
38 | end |
39 | end |
40 | end |
41 | html << "</span>" while regions.pop |
42 | html << "</pre>" if pre |
43 | html |
44 | end |
45 | |
46 | private |
47 | |
48 | # Replaces some characters with their corresponding HTML entities. |
49 | def html_escape( string ) |
50 | string.gsub( /&/, "&" ). |
51 | gsub( /</, "<" ). |
52 | gsub( />/, ">" ). |
53 | gsub( /"/, """ ) |
54 | end |
55 | |
56 | end |
57 | |
58 | end |
59 | end |
60 | }}} |
61 | |
62 | Within the @#convert@ method, you will automatically have access to the @tokenizer@ instance variable--instantiated for you by the framework. The rest is up to you. |