Not signed in (Sign In)

Categories

Vanilla 1.1.1 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorbmsterling
    • CommentTimeJan 24th 2007
     permalink
    Hey Gals and Gals,
    I looked around for directions on how to make a bundle/add-on and could not find. I want to create a jQuery bundle, so any direction would be greatly appreciated.

    Thanks,
    Benjamin Sterling
    •  
      CommentAuthortstrokes
    • CommentTimeJan 24th 2007 edited
     permalink

    Take a look at the existing javascript.itBundle.
    Look at the .itGrammer in the syntaxes folder.
    This file describes javascript’s syntax.
    In the snippets folder you’ll find a prototype snippet.
    Copy it and adapt it to fit your needs.

    Existing Bundle folder structure

    -javascript.itBundle --snippets ---prototype.itSnippet --syntaxes ---javascript.itGrammer -info.itInfo -- optional describes the menu structure.

    JQuery will be easier cause you’ll mainly be creating snippets cause the javascript grammar is already there.

    • CommentAuthormartincohen
    • CommentTimeJan 24th 2007 edited
     permalink

    Yes, that’s actually true. But until we have some documentation for this I can help you with this in this thread. First, create a folder named “JavaScript jQuery.itBundle” in bundles folder. Bundles in Intype currently consists of three basic components:

    • Grammar(s): Grammars are placed in syntaxes/ subfolder in bundle folder. Grammar file must have .itGrammar extension.
    • Snippets: Are placed in syntaxes/ subfolder. Snippets have .itSnippet extension
    • Bundle Info: Is file info.itInfo placed in the root of the bundle folder

    Take a look at organization of HTML.itBundle for example.

    • CommentAuthorbmsterling
    • CommentTimeJan 24th 2007
     permalink
    Thanks guys, I will work on this today going off the current jquery api.
    • CommentAuthormartincohen
    • CommentTimeJan 24th 2007 edited
     permalink

    Configuration files

    Format used for all those items is called Jasmine. It is simple serialization format for definig structured config files which can contain: arrays, associative arrays called dictionaries (like objects in JavaScript), strings (unquoted – called symbols, quoted and double quoted), numbers (int, unsigned int, float), flags (boolean) and null value:

    Arrays are delimited by square brackets []. So example array might look like this one:

    [ 'orange' 'apple' 'peach' ]

    In jasmine, there’s no need to delimit items by comma, but nothing happens if you use it.

    Dictionaries are associative containers. Each value it it MUST have key symbol associated with it.
    For example:

    { title: 'jQuery' scope_name: 'source.js.jquery' file_types: [ 'js' 'jquery' ] }

    Threre are two types of string in Jasmine: single quoted and double quoted.

    Single quoted string is a very simple string for direct input and it does not translate any escape sequences. ‘ \n ‘ outputs \n as chars not as new line character. There’s only one special sequence for inserting a single quote into string: ‘’ (two single quotes).

    Double quoted string supports these escapes:

    • \n for new line (i.e. CR+LF)
    • \t for tab character
    • \\ for \
    • \” for double quote

    Both strings are multilined. There are many other features in Jasmine and will be detailed in documentation.

    Another special case of string is a symbol. Symbol is mainly used as a key value in directory. Symbol can only consist of uppercase letters (‘A’ to ‘Z’), lowercase letters (‘a’ to ‘z’), numeric characters (‘0’ to ‘9’) and three special characters ‘_’ underscore, ‘-’ minus and ‘.’ dot.

    Now we can start with a grammar.

    • CommentAuthormartincohen
    • CommentTimeJan 24th 2007 edited
     permalink

    Grammar

    For the library like jQuery the grammar is simple. You have to only define keywords and include the JavaScript grammar in it. The example grammar for us would be JavaScript YUI.itBundle (download) because it is very similiar to jQuery — it extends JavaScript grammar by adding keyword definitions.

    { title: 'jQuery' scope_name: 'source.js.jquery' patterns: [ { match: /\b(YAHOO)\b/ name: 'support.class.js.yui' } { match: /\.(util|widget|example)\b/ name: 'support.class.js.yui' } ... { include: 'source.js' } ] }

    Try to take a look at the Javascript YUI grammar.