Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

42 lines
1.1 KiB
Plaintext

== Why is this an issue?
Template strings allow developers to embed variables or expressions in strings using template literals, instead of string concatenation. This is done by using expressions like ``++${variable} ++`` in a string between two back-ticks (``++`++``). However, when used in a regular string literal (between double or single quotes) the template will not be evaluated and will be used as a literal, which is probably not what was intended.
=== Noncompliant code example
[source,javascript]
----
console.log("Today is ${date}"); // Noncompliant
----
=== Compliant solution
[source,javascript]
----
console.log(`Today is ${date}`);
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Replace the quotes (["|']) with back-ticks (`).
'''
== Comments And Links
(visible only on this page)
=== on 5 Dec 2016, 16:30:37 Elena Vilchik wrote:
\[~jeanchristophe.collet] WDYT about renaming to "Template literal placeholder syntax should not be used in regular strings"?
endif::env-github,rspecator-view[]