Hi,
I have a small embedded mini-language that allows me to include HTML and CSS files inline inside the code.
The layout is something like this:
------ 8< ----- @@ filename.html <div>....</div>
@@ styles.css ... css stuff ...
@@ other.html ... more html...
------ 8< -----
I'm using something like this:
{ name = 'embedded.html'; begin = '^(@@)\s+(.+[.]html?)\s*$'; end = '^@@'; captures = { 1 = { name = 'embedded.marker'; }; 2 = { name = 'embedded.filename'; }; }; patterns = ( { include = 'text.html'; } ); }, { name = 'embedded.css'; begin = '^(@@)\s+(.+[.]css)\s*$'; end = '^@@'; captures = { 1 = { name = 'embedded.marker'; }; 2 = { name = 'embedded.filename'; }; }; patterns = ( { include = 'text.css'; } ); },
But the problem is that the "end" rule captures the @@ pair to it cannot be matched by the next block "begin".
If I add an extra @@ just before the second file, it all works fine.
Is there any trick to get around this?
Thanks,
If I understand you correctly, the end of the embedded section is simply the next '@@' start marker. So, change your end match to use a look-ahead:
end = '^(?=@@)';
On Fri, Nov 5, 2010 at 11:19 AM, Pedro Melo melo@simplicidade.org wrote:
Hi,
I have a small embedded mini-language that allows me to include HTML and CSS files inline inside the code.
The layout is something like this:
------ 8< ----- @@ filename.html
<div>....</div>
@@ styles.css ... css stuff ...
@@ other.html ... more html...
------ 8< -----
I'm using something like this:
{ name = 'embedded.html'; begin = '^(@@)\s+(.+[.]html?)\s*$'; end = '^@@'; captures = { 1 = { name = 'embedded.marker'; }; 2 = { name = 'embedded.filename'; }; }; patterns = ( { include = 'text.html'; } ); }, { name = 'embedded.css'; begin = '^(@@)\s+(.+[.]css)\s*$'; end = '^@@'; captures = { 1 = { name = 'embedded.marker'; }; 2 = { name = 'embedded.filename'; }; }; patterns = ( { include = 'text.css'; } ); },
But the problem is that the "end" rule captures the @@ pair to it cannot be matched by the next block "begin".
If I add an extra @@ just before the second file, it all works fine.
Is there any trick to get around this?
Thanks,
Pedro Melo http://www.simplicidade.org/ xmpp:melo@simplicidade.org xmpp%3Amelo@simplicidade.org mailto:melo@simplicidade.org
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi,
On Fri, Nov 5, 2010 at 7:41 PM, Josh Varner josh.varner@gmail.com wrote:
If I understand you correctly, the end of the embedded section is simply the next '@@' start marker.
Yep.
So, change your end match to use a look-ahead: end = '^(?=@@)';
Ah, perfect! :)
I didn't knew that TextMate already supported that, coolness
Many thanks Josh,