Sha256: 36017c32486f07fbb5bd31b4051790f136cf1dbf26218d838898677d1b09b4f0

Contents?: true

Size: 756 Bytes

Versions: 20

Compression:

Stored size: 756 Bytes

Contents

Once you've written your new syntax module, you need to register it with the Syntax library so that it can be found and used by the framework. To do this, just add it to the @Syntax::SYNTAX@ hash:

{{{lang=ruby,number=true,caption=Registering a new syntax
require 'syntax'

class SimpleTokenizer < Syntax::Tokenizer
  ...
end

Syntax::SYNTAX['simple'] = SimpleTokenizer
}}}

That's it! Once you've done that, you can now use your syntax just by requiring the file that defines it, and then using the standard Syntax framework methods:

{{{lang=ruby,number=true,caption=Using your new syntax
require 'simple-tokenizer'
require 'syntax/convertor/html'

convertor = Syntax::Convertors::HTML.for_syntax "simple"
puts convertor.convert( "hello 15 worlds!" )
}}}

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
typo-3.99.0 vendor/syntax/doc/manual/parts/0010.txt
typo-3.99.1 vendor/syntax/doc/manual/parts/0010.txt
typo-3.99.3 vendor/syntax/doc/manual/parts/0010.txt
typo-3.99.2 vendor/syntax/doc/manual/parts/0010.txt
typo-4.0.0 vendor/syntax/doc/manual/parts/0010.txt
typo-3.99.4 vendor/syntax/doc/manual/parts/0010.txt
typo-4.0.2 vendor/syntax/doc/manual/parts/0010.txt
typo-4.0.1 vendor/syntax/doc/manual/parts/0010.txt
typo-4.0.3 vendor/syntax/doc/manual/parts/0010.txt
typo-4.1.1 vendor/syntax/doc/manual/parts/0010.txt
typo-5.0.1 vendor/syntax/doc/manual/parts/0010.txt
typo-5.0.2 vendor/syntax/doc/manual/parts/0010.txt
typo-4.1 vendor/syntax/doc/manual/parts/0010.txt
typo-5.0.3.98.1 vendor/syntax/doc/manual/parts/0010.txt
typo-5.0 vendor/syntax/doc/manual/parts/0010.txt
typo-5.0.3.98 vendor/syntax/doc/manual/parts/0010.txt
typo-5.1.1 vendor/syntax/doc/manual/parts/0010.txt
typo-5.1.2 vendor/syntax/doc/manual/parts/0010.txt
typo-5.1.3 vendor/syntax/doc/manual/parts/0010.txt
typo-5.1 vendor/syntax/doc/manual/parts/0010.txt