Skip to content

VBS in HTML (evil) #2

Open
Open

Description

@enkore

Yeah I know embedding VBScript in HTML is evil, but I often need to work with such stuff :(
However, even with VBScript installed Sublime Text 2 thinks that stuff inside <script>-Tags with language="VBScript" is JavaScript... well as I don't really know how to edit tmLanguage files it would be very nice to have this...
If someone got a tutorial how stuff like this (syntax highlighting for other languages) in a tmLanguage file is done, I'd do this my self and make a pull a request...
I guess that must be added to the HTML package, doesn't it? Well I dunno .. :D

Activity

  1. jsadeli commented on May 14, 2012

    @jsadeli
    Member

    Hey enkore, do you have an example of this? I can probably take a look and see what I can do - no promises! :)

    In regards to the tmLanguage, I found this or this to be pretty helpful.

  2. enkore commented on May 15, 2012

    @enkore
    Author

    Those files often have the extensions .hta (HTml Application), but it's also possible in normal HTML files.
    That basically looks like this:

    <html>
    
    <head>
    <title>some crappy app</title>
    
    <HTA:APPLICATION
      APPLICATIONNAME="BullShitOMeter"
      ID="objBullShitOMeter"
      SINGLEINSTANCE="yes"
      WINDOWSTATE="maximize"/>
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    
    <script language="VBScript">
    
    Option Explicit
    
    ' global definitions
    
    Const HKEY_LOCAL_MACHINE = &H80000002
    Const HKEY_CURRENT_USER  = &H80000001
    const REG_SZ = 1
    const REG_EXPAND_SZ = 2
    const REG_BINARY = 3
    const REG_DWORD = 4
    const REG_MULTI_SZ = 7
    
    Dim dlg
    dim okB ' as integer
    dim ynB ' as integer
    
    Sub StartBSOM
        ' ...'
    end sub
    
    </script>
    <body>
    <!-- normal HTML -->
    <div id="container">
    
    </div>
    >
    <table width = "100%" >
        <tr>
            ...
        </tr>
    </table>
    
    </body>
    </html>
    

    So it is like the JavaScript-script-tag, except that it contains VBScript...
    Currently Sublime Text 2 treats everything inside a script-tag like JavaScript, so the syntax highlighting is pretty much botched up (comments are highlighted like strings and stuff like that)

  3. jsadeli commented on May 15, 2012

    @jsadeli
    Member

    At first glance, looks like there would need to be at least a patch to the built in HTML.tmLanguage file to support other languages beside JavaScript. Another possibility would be to have a new syntax language, something like HTML (VBScript).

    Also, sadly, my tmLanguage reading and editing mojo isn't high enough yet - would need to level up first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions