← every case · 6000 · another language inside the file

6090-vue_blocks_count_as_their_own_languages

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

read ascloc.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.vue
1code<template>
2code <p class="a">it's fine</p>
3comments <!-- a template comment -->
4code</template>
5code<script>
6comments JavaScript// a js comment
7blanks JavaScript
8code JavaScriptvar x = "</p>";
9code</script>
10code<style>
11comments CSS/* a css comment */
12code CSS.a { color: red; }
13code</style>

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

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

the rules ask13 lines · 1 blanks · 9 code · 3 comments · CSS 2 · JavaScript 3
it answers13 lines · 1 blanks · 9 code · 3 comments

cloc --json cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue

mezura.content ✓ agrees
the rules ask13 lines · 9 code · 3 comments · 1 extra · CSS 2 · JavaScript 3
it answers13 lines · 9 code · 3 comments · 1 extra · CSS 2 · JavaScript 3

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.region ✓ agrees
the rules ask13 lines · 1 blanks · 9 code · 3 comments · CSS 2 · JavaScript 3
it answers13 lines · 1 blanks · 9 code · 3 comments · CSS 2 · JavaScript 3

mezura cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue --output json --hide timing --counting region

scc.default ✗ fails

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

the rules ask13 lines · 1 blanks · 9 code · 3 comments · CSS 2 · JavaScript 3
it answers13 lines · 0 blanks · 13 code · 0 comments

scc --format json cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue

tokei.default ✗ fails

the apostrophe of "it's" opens a string, and the template comment under it is counted as code

the rules ask13 lines · 1 blanks · 9 code · 3 comments · CSS 2 · HTML 2 · JavaScript 3
it answers13 lines · 1 blanks · 10 code · 2 comments · CSS 2 · HTML 2 · JavaScript 3

tokei --output json cases/6000-another_language_inside_the_file/6090-vue_blocks_count_as_their_own_languages/input.vue