0
votes

For our HTML templates, we use a content aggregation engine based on a namespaced XML-based markup syntax that has some custom tags defining various fragments of the template. For example, for js code we have:

<foo:js src="http://..." />
<p>
   This is regular HTML; this document with the namespaced tags will be 
   aggregated into HTML by our metalanguage aggregator.
</p>
<foo:js>
    console.log('bar');
</foo:js>

I'd be very happy if these could be parsed and edited as JS code or JS reference tags (the self-closing one) in phpStorm. I figured out the "Language injections" settings is designed for that, but I can't find any documentation how to achieve this. The "Places Patterns" seems to be the key to this enigma. So can anyone provide some hints into how to do this using Language Injection(s)?

Also, for the rest of the tags, as a simple form of completion/validation, is it possible to specify a default XML schema (i.e. XSD) for the namespace? I mean, apart from explicit xmlns:foo tags, because our markup files represent fragments so we'd have to add quite a number of these on quite a lot of elements.

1

1 Answers

2
votes

The following injection will highlight javascript in all <namespace:js> tags:

enter image description here

enter image description here