HTML syntax: highlight text/html blocks properly

2014-07-10 Thread Daniel Ashbrook
I'm working with a HTML templating engine (Knockout) where templates are 
embedded as script type=text/html blocks; a small example file might look 
like the following:

html
head

script src=jquery.js/script

script type=text/html id=my-template
divHello/div
/script

script
$(document).ready(function(){alert(Hi!)});
/script

/head

body
h1Test!/h1
div data-bind=template: 'my-template'/div
/body

/html

The issue I'm having is that the html.vim syntax file treats anything with a 
script start as javascript:

 syn region  javaScript start=+script\_[^]*+  ...

Instead, javascript regions should start with either

script

or

script type=text/javascript

and script type=text/html should be formatted accordingly.


I've spent quite a bit of time poking around at this problem and can't seem to 
figure it out without modifying the actual system-level syntax file itself. 
Hopefully someone can advise!



dan
---
Daniel Ashbrook, Ph.D.
Samsung Research America
http://danielashbrook.com

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: syntax highlight to html - yeah - poor character rendering - solved

2010-08-25 Thread Ben Fritz


On Aug 24, 4:52 pm, Eric Smith e...@fruitcom.com wrote:

  However, I am not getting non-ascii rendering in my html - in the
  terminal even Icelandic is perfectly rendered.

  I tried setting the var below to my $LANG variable.
  :let g:html_use_encoding = en_US.UTF-8

  no joy

  Is there a fix?

 With
 :let g:html_use_encoding = utf-8


I'm glad you got it working. I'm curious though, why TOhtml's auto-
detection of the proper encoding broke down.

What is Vim's 'encoding' option set to for you? Perhaps this not the
appropriate option to use to detect the encoding to use in the html?

I admit I'm not very knowledgeable in this area.

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


syntax highlight to html

2010-08-24 Thread Eric Smith
Has anyone written a utility to convert syntax highlighted vim
to a printable or displayable format like html, rtf or pdf?

I have my own customised highlight rules and want to be lazy and
just autogenerate to a format that I can send to someone.

Am I in luck?
-- 
- Eric Smith

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax highlight to html

2010-08-24 Thread Tim Chase

On 08/24/10 14:18, Eric Smith wrote:

Has anyone written a utility to convert syntax highlighted vim
to a printable or displayable format like html, rtf or pdf?


If you want HTML, Vim comes with it stock:

  :help 2html

and following for various methods of using Vim's HTML-generation 
methods.


-tim


--
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax highlight to html

2010-08-24 Thread sc
On Tuesday 24 August 2010 14:18:18 Eric Smith wrote:

 Has anyone written a utility to convert syntax highlighted vim
 to a printable or displayable format like html, rtf or pdf?

 I have my own customised highlight rules and want to be lazy
 and just autogenerate to a format that I can send to someone.

 Am I in luck?

yes, and it is included in a normal install

just edit the module you want to print and issue

:TOhtml

this will save it with an 'html' extension and you can open
that and print from your browser

the command accepts a range too if you don't want to print the
whole thing -- see

:h 2html.vim

for a more complete description

sc

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax highlight to html - yeah

2010-08-24 Thread Eric Smith
Damn, why do I only hear about this now?

Any cool vim twitterers that can let me know when stuff like this and 
serialisable undo tree (yes I saw that in the changes file of 7,3)
become available.

:TOhtml - how` cool is that :)

-- 
- Eric Smith
sc said:
 On Tuesday 24 August 2010 14:18:18 Eric Smith wrote:
 
  Has anyone written a utility to convert syntax highlighted vim
  to a printable or displayable format like html, rtf or pdf?
 
  I have my own customised highlight rules and want to be lazy
  and just autogenerate to a format that I can send to someone.
 
  Am I in luck?
 
 yes, and it is included in a normal install
 
 just edit the module you want to print and issue
 
 :TOhtml
 
 this will save it with an 'html' extension and you can open
 that and print from your browser
 
 the command accepts a range too if you don't want to print the
 whole thing -- see
 
 :h 2html.vim
 
 for a more complete description
 
 sc
 
 -- 
 You received this message from the vim_use maillist.
 Do not top-post! Type your reply below the text you are replying to.
 For more information, visit http://www.vim.org/maillist.php

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax highlight to html - yeah

2010-08-24 Thread Tim Chase

On 08/24/10 14:49, Eric Smith wrote:

Any cool vim twitterers that can let me know when stuff like this and
serialisable undo tree (yes I saw that in the changes file of 7,3)
become available.

:TOhtml - how` cool is that :)


I don't know of any twitter feeds on tips like that, but there's 
a Vim wiki which you might monitor for good tips.


Otherwise, I just use this mailing list as my feed of power-user 
tips.  Like Christian's elegant sort within a line post that 
just popped up.  I tend to think of list-comprehension'y answers 
like that when I'm coding in Python, but still treat Vim's List 
and Dict as not everybody has them features (mostly because 
I've still got Vim 6.x on a few boxes, so I'm among the have-nots 
in some cases) which prevents me from reaching for them as often 
as I should.  So I appreciate the reminders.


-tim




--
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax highlight to html - yeah - poor character rendering

2010-08-24 Thread Eric Smith
However, I am not getting non-ascii rendering in my html - in the 
terminal even Icelandic is perfectly rendered.

I tried setting the var below to my $LANG variable.
:let g:html_use_encoding = en_US.UTF-8

no joy

Is there a fix?

-- 
- Eric Smith
Eric Smith said:
 Damn, why do I only hear about this now?
 
 Any cool vim twitterers that can let me know when stuff like this and 
 serialisable undo tree (yes I saw that in the changes file of 7,3)
 become available.
 
 :TOhtml - how` cool is that :)
 
 -- 
 - Eric Smith
 sc said:
  On Tuesday 24 August 2010 14:18:18 Eric Smith wrote:
  
   Has anyone written a utility to convert syntax highlighted vim
   to a printable or displayable format like html, rtf or pdf?
  
   I have my own customised highlight rules and want to be lazy
   and just autogenerate to a format that I can send to someone.
  
   Am I in luck?
  
  yes, and it is included in a normal install
  
  just edit the module you want to print and issue
  
  :TOhtml
  
  this will save it with an 'html' extension and you can open
  that and print from your browser
  
  the command accepts a range too if you don't want to print the
  whole thing -- see
  
  :h 2html.vim
  
  for a more complete description
  
  sc
  
  -- 
  You received this message from the vim_use maillist.
  Do not top-post! Type your reply below the text you are replying to.
  For more information, visit http://www.vim.org/maillist.php

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php