Skip to content

Commit eb0fd2e

Browse files
The symbol for inserting text has been changed.
1 parent acc2bcd commit eb0fd2e

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

elementOfHtml.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ export class ElementOfHtml {
154154
}
155155
#setTextFromComment(entryRule) {
156156
let commentWithText = entryRule.declarations.find(decl =>
157-
decl?.comment?.match(/<@>.*<\/@>/s)[0]
157+
decl?.comment?.match(/{{.*}}/s)[0]
158158
)
159159
if (!commentWithText) return
160160

161161
// Removing spaces necessary for readability of a comment
162162
commentWithText.comment = commentWithText.comment.slice(1, -1)
163163

164-
let textBefore = commentWithText.comment.match(/^.*(?=<@>)/s)?.at(0)
165-
let text = commentWithText.comment.match(/(?<=<@>).*?(?=<\/@>|$)/s)?.at(0)
166-
let textAfter = commentWithText.comment.match(/(?<=<\/@>).*$/s)?.at(0)
164+
let textBefore = commentWithText.comment.match(/^.*(?={{)/s)?.at(0)
165+
let text = commentWithText.comment.match(/(?<={{).*?(?=}}|$)/s)?.at(0)
166+
let textAfter = commentWithText.comment.match(/(?<=}}).*$/s)?.at(0)
167167

168168
this.textBefore = textBefore
169169
this.text = text

tests/IO.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test('Empty CSS should not be processed.', () => {
7171
})
7272

7373
test('The code from the CSS file must be processed.', () => {
74-
fs.writeFileSync(cssFilePath, 'div {} div span { /* <@>text</@> */ }')
74+
fs.writeFileSync(cssFilePath, 'div {} div span { /* {{text}} */ }')
7575

7676
assert.equal(
7777
new CssToHtml({

tests/attrs.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { CssToHtml } from '../cssToHtml.js'
22
import assert from 'assert'
33
import test from 'node:test'
4-
import { dot } from 'node:test/reporters'
54

65
test('Attributes in the selector must be processed.', () => {
76
assert.equal(

tests/text.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import test from 'node:test'
55
test('The text inside the tag must be processed', () => {
66
assert.equal(
77
new CssToHtml({
8-
css: `div { /* <@>inner text</@> */ }`,
8+
css: `div { /* {{inner text}} */ }`,
99
})
1010
.outputHTML,
1111

@@ -15,7 +15,7 @@ test('The text inside the tag must be processed', () => {
1515
test('The text before the tag must be processed', () => {
1616
assert.equal(
1717
new CssToHtml({
18-
css: `div { /* before text<@></@> */ }`,
18+
css: `div { /* before text{{}} */ }`,
1919
})
2020
.outputHTML,
2121

@@ -25,7 +25,7 @@ test('The text before the tag must be processed', () => {
2525
test('The text after the tag must be processed', () => {
2626
assert.equal(
2727
new CssToHtml({
28-
css: `div { /* <@></@>after text */ }`,
28+
css: `div { /* {{}}after text */ }`,
2929
})
3030
.outputHTML,
3131

@@ -35,7 +35,7 @@ test('The text after the tag must be processed', () => {
3535
test('The text without additional spaces should be saved without spaces.', () => {
3636
assert.equal(
3737
new CssToHtml({
38-
css: `div { /* before text<@>inner text</@>after text */ }`,
38+
css: `div { /* before text{{inner text}}after text */ }`,
3939
})
4040
.outputHTML,
4141

@@ -46,7 +46,7 @@ test('The text with additional spaces should keep them.', () => {
4646
assert.match(
4747
new CssToHtml({
4848
css:
49-
`div { /* before text <@> inner text </@> after text */ }`,
49+
`div { /* before text {{ inner text }} after text */ }`,
5050
})
5151
.outputHTML,
5252

@@ -60,11 +60,11 @@ test('The text should be processed along with the new lines.', () => {
6060
div { /*
6161
before 1
6262
before 2
63-
<@>
63+
{{
6464
inner 1
6565
inner 2
6666
inner 3
67-
</@>after 1
67+
}}after 1
6868
after 2
6969
*/ }`,
7070
})

0 commit comments

Comments
 (0)