Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VBS in HTML (evil) #2

Open
enkore opened this issue May 13, 2012 · 3 comments
Open

VBS in HTML (evil) #2

enkore opened this issue May 13, 2012 · 3 comments
Labels

Comments

@enkore
Copy link

enkore commented May 13, 2012

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

@jsadeli
Copy link
Member

jsadeli commented May 14, 2012

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.

@enkore
Copy link
Author

enkore commented May 15, 2012

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)

@jsadeli
Copy link
Member

jsadeli commented May 15, 2012

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants