← every case · 6000 · another language inside the file
the opening tag names the language of its block, so this file is Vue, TypeScript and SCSS and not Vue, JavaScript and CSS. Every count comes out the same either way, so nothing but the names themselves can tell a counter that read the tags from one that guessed
| 1 | codecodecodecodecode | <template> |
| 2 | codecodecodecodecode HTML | <p>x</p> |
| 3 | codecodecodecodecode | </template> |
| 4 | codecodecodecodecode | <script lang="ts"> |
| 5 | comments TypeScriptcomments TypeScriptcomments TypeScriptcomments TypeScriptcomments TypeScript | // a ts comment |
| 6 | code TypeScriptcode TypeScriptcode TypeScriptcode TypeScriptcode TypeScript | interface Point { x: number } |
| 7 | codecodecodecodecode | </script> |
| 8 | codecodecodecodecode | <style lang="scss"> |
| 9 | comments SCSScomments SCSScomments SCSScomments SCSScomments SCSS | // an scss line comment, which plain css does not have |
| 10 | code SCSScode SCSScode SCSScode SCSScode SCSS | .a { .b { color: red; } } |
| 11 | codecodecodecodecode | </style> |
stringcommentthe tag around another language
the file is counted as one language from beginning to end and no lang attribute is read, so every number comes out right only because those symbols already treat // as a comment
cloc --json cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue
mezura cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue --output json --hide timing --counting content
mezura cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue --output json --hide timing --counting region
the file is counted as one language from beginning to end. The totals come out right because both block comment symbols happen to be the ones Vue's own markup already declares, and neither block is found
scc --format json cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue
counts the same lines and calls the two blocks JavaScript and CSS, although each tag names its own language
tokei --output json cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue