← every case · 6000 · another language inside the file
one file, three languages: the script and style blocks are counted with their own symbols, so the js comment and the css comment are comments although the Vue file holding them has neither symbol
| 1 | codecodecodecodecode | <template> |
| 2 | codecodecodecodecode HTML | <p class="a">it's fine</p> |
| 3 | commentscommentscommentscommentscomments HTML | <!-- a template comment --> |
| 4 | codecodecodecodecode | </template> |
| 5 | codecodecodecodecode | <script> |
| 6 | comments JavaScriptcomments JavaScriptcomments JavaScriptcomments JavaScriptcomments JavaScript | // a js comment |
| 7 | blanks JavaScriptextra JavaScriptblanks JavaScriptblanks JavaScriptblanks JavaScript | |
| 8 | code JavaScriptcode JavaScriptcode JavaScriptcode JavaScriptcode JavaScript | var x = "</p>"; |
| 9 | codecodecodecodecode | </script> |
| 10 | codecodecodecodecode | <style> |
| 11 | comments CSScomments CSScomments CSScomments CSScomments CSS | /* a css comment */ |
| 12 | code CSScode CSScode CSScode CSScode CSS | .a { color: red; } |
| 13 | codecodecodecodecode | </style> |
stringcommentthe tag around another language
the file is counted as one language from beginning to end, and every number comes out right only because the symbols it applies to a vue file already cover the markup, the js and the css comments, while neither block is named
cloc --json cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue
mezura cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue --output json --hide timing --counting content
mezura cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue --output json --hide timing --counting region
the file is counted as one language from beginning to end, so neither block is found. What makes every line code is the apostrophe in it's, which opens a string that never closes: with that word spelled without it, the same unsplit file comes out right
scc --format json cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue
the apostrophe of "it's" opens a string, and the template comment under it is counted as code
tokei --output json cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue