Re: <code> element and scripting languages.

Andrea,

Le 6 mars 2015 à 09:32, Andrea Rendine <master.skywalker.88@gmail.com> a écrit :
> It wouldn't be difficult: according to BCP47, valid *existing* language tags can contain "private use subtags" in the form of a string consisting of "x-" followed by up to 8 alphabetic characters. 

A good reference for language tags
http://www.w3.org/International/articles/language-tags/

Would this be working for you?

   <pre data-code-lang='php js'
        id='source_code'>

       [… some code …]

   </pre>


   <script>
     var source = document.getElementById('source_code');
     var languages = source.getAttribute('data-code-lang'); // languages = 'php js'
     // Do something like syntax coloring here
   </script>


-- 
Karl Dubost 🐄
http://www.la-grange.net/karl/

Received on Friday, 6 March 2015 01:56:05 UTC