← every case · 6000 · another language inside the file

6080-block_named_by_a_mime_type

a script tag can name its language with a mime type instead of a lang attribute, and a mime type spells the language out: 'text/typescript', not 'text/ts'. The counts are the same whichever language answers, so what this case is about is the label

read ascloc.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.html
1code<script type="text/typescript">
2comments TypeScript// a comment inside the section
3code TypeScriptinterface Point { x: number }
4code</script>

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

the file is counted as one language from beginning to end, so a block named by a mime type is read with the page's symbols and the comment inside it lands in code

the rules ask4 lines · 0 blanks · 3 code · 1 comments · TypeScript 2
it answers4 lines · 0 blanks · 4 code · 0 comments

cloc --json cases/6000-another_language_inside_the_file/6080-block_named_by_a_mime_type/input.html

mezura.content ✓ agrees
the rules ask4 lines · 3 code · 1 comments · 0 extra · TypeScript 2
it answers4 lines · 3 code · 1 comments · 0 extra · TypeScript 2

mezura cases/6000-another_language_inside_the_file/6080-block_named_by_a_mime_type/input.html --output json --hide timing --counting content

mezura.region ✓ agrees
the rules ask4 lines · 0 blanks · 3 code · 1 comments · TypeScript 2
it answers4 lines · 0 blanks · 3 code · 1 comments · TypeScript 2

mezura cases/6000-another_language_inside_the_file/6080-block_named_by_a_mime_type/input.html --output json --hide timing --counting region

scc.default ✗ fails

the block is not found, so the comment inside it counts as markup

the rules ask4 lines · 0 blanks · 3 code · 1 comments · TypeScript 2
it answers4 lines · 0 blanks · 4 code · 0 comments

scc --format json cases/6000-another_language_inside_the_file/6080-block_named_by_a_mime_type/input.html

tokei.default ✗ fails

the block is counted as JavaScript, although the mime type names TypeScript and their TypeScript is a language of its own

the rules ask4 lines · 0 blanks · 3 code · 1 comments · TypeScript 2
it answers4 lines · 0 blanks · 3 code · 1 comments · JavaScript 2

tokei --output json cases/6000-another_language_inside_the_file/6080-block_named_by_a_mime_type/input.html