Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: Issue #240 updating the counter initial value from 0 to 1 - PR #264 workflow bug #266

Merged
4 changes: 4 additions & 0 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Maven Site
on:
push:
branches: [ main ]
paths:
- '.github/workflows/javadoc.yml'
- 'jsgenerator-core/**'
- 'pom.xml'

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# About

Translating from HTML to JS.
Translating from HTML to JS

> This project is different from the
> [JavaScript Generator Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public String nextName(@NonNull String type) {
}
}

return format("%s_%03d", identifier, counters.computeIfAbsent(type, __ -> new AtomicLong()).getAndIncrement());
return format("%s_%03d", identifier, counters.computeIfAbsent(type, __ -> new AtomicLong(1)).getAndIncrement());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ void convertInlineContent(final VariableDeclaration variableDeclaration, final b
jsonPath("$.content.length()").value(1),
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
jsonPath("$.content.[0].content").value(new Match(new String[]{
"%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword),
"%s div_000 = document.createElement('div');".formatted(keyword),
"div_000.setAttribute(`contenteditable`, `true`);",
"%s text_000 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_000.appendChild(text_000);",
"targetElement_000.appendChild(div_000);"
"%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword),
"%s div_001 = document.createElement('div');".formatted(keyword),
"div_001.setAttribute(`contenteditable`, `true`);",
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_001.appendChild(text_001);",
"targetElement_001.appendChild(div_001);"
})));


Expand All @@ -210,10 +210,10 @@ void convertInlineContent(final VariableDeclaration variableDeclaration, final b
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
jsonPath("$.content.[0].content").value(new Match(new String[]{

"%s div_000 = document.createElement('div');".formatted(keyword),
"div_000.setAttribute(`contenteditable`, `true`);",
"%s text_000 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_000.appendChild(text_000);"
"%s div_001 = document.createElement('div');".formatted(keyword),
"div_001.setAttribute(`contenteditable`, `true`);",
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_001.appendChild(text_001);"

})));

Expand Down Expand Up @@ -253,16 +253,16 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati
jsonPath("$.content.length()").value(1),
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
jsonPath("$.content.[0].content").value(new Match(new String[]{
"%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword),
"%s comment_000 = document.createComment(` ContentEditable `);".formatted(keyword),
"targetElement_000.appendChild(comment_000);",
"%s text_000 = document.createTextNode(` `);".formatted(keyword),
"targetElement_000.appendChild(text_000);",
"%s div_000 = document.createElement('div');".formatted(keyword),
"div_000.setAttribute(`contenteditable`, `true`);",
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_000.appendChild(text_001);",
"targetElement_000.appendChild(div_000);"
"%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword),
"%s comment_001 = document.createComment(` ContentEditable `);".formatted(keyword),
"targetElement_001.appendChild(comment_001);",
"%s text_001 = document.createTextNode(` `);".formatted(keyword),
"targetElement_001.appendChild(text_001);",
"%s div_001 = document.createElement('div');".formatted(keyword),
"div_001.setAttribute(`contenteditable`, `true`);",
"%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_001.appendChild(text_002);",
"targetElement_001.appendChild(div_001);"
})));


Expand All @@ -287,14 +287,14 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati
jsonPath("$.content.length()").value(1),
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
jsonPath("$.content.[0].content").value(new Match(new String[]{
"%s targetElement_000 = document.querySelector(`:root > body`);".formatted(keyword),
"%s text_000 = document.createTextNode(` `);".formatted(keyword),
"targetElement_000.appendChild(text_000);",
"%s div_000 = document.createElement('div');".formatted(keyword),
"div_000.setAttribute(`contenteditable`, `true`);",
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_000.appendChild(text_001);",
"targetElement_000.appendChild(div_000);"
"%s targetElement_001 = document.querySelector(`:root > body`);".formatted(keyword),
"%s text_001 = document.createTextNode(` `);".formatted(keyword),
"targetElement_001.appendChild(text_001);",
"%s div_001 = document.createElement('div');".formatted(keyword),
"div_001.setAttribute(`contenteditable`, `true`);",
"%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_001.appendChild(text_002);",
"targetElement_001.appendChild(div_001);"
})));

}
Expand All @@ -321,12 +321,12 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati
jsonPath("$.content.length()").value(1),
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
jsonPath("$.content.[0].content").value(new Match(new String[]{
"%s comment_000 = document.createComment(` ContentEditable `);".formatted(keyword),
"%s text_000 = document.createTextNode(` `);".formatted(keyword),
"%s div_000 = document.createElement('div');".formatted(keyword),
"div_000.setAttribute(`contenteditable`, `true`);",
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_000.appendChild(text_001);"
"%s comment_001 = document.createComment(` ContentEditable `);".formatted(keyword),
"%s text_001 = document.createTextNode(` `);".formatted(keyword),
"%s div_001 = document.createElement('div');".formatted(keyword),
"div_001.setAttribute(`contenteditable`, `true`);",
"%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_001.appendChild(text_002);"
})));


Expand All @@ -350,11 +350,11 @@ void convertInlineContentWithComment(final VariableDeclaration variableDeclarati
jsonPath("$.content.length()").value(1),
jsonPath("$.content.[0].filename").value("%s.0.%s".formatted(prefix, extension)),
jsonPath("$.content.[0].content").value(new Match(new String[]{
"%s text_000 = document.createTextNode(` `);".formatted(keyword),
"%s div_000 = document.createElement('div');".formatted(keyword),
"div_000.setAttribute(`contenteditable`, `true`);",
"%s text_001 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_000.appendChild(text_001);"
"%s text_001 = document.createTextNode(` `);".formatted(keyword),
"%s div_001 = document.createElement('div');".formatted(keyword),
"div_001.setAttribute(`contenteditable`, `true`);",
"%s text_002 = document.createTextNode(`%s`);".formatted(keyword, content),
"div_001.appendChild(text_002);"
})));

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,104 +1,104 @@
{{keyword}} targetElement_000 = document.querySelector(`:root > body`);
{{keyword}} html_000 = document.createElement('html');
{{keyword}} text_000 = document.createTextNode(` `);
html_000.appendChild(text_000);
{{keyword}} head_000 = document.createElement('head');
{{keyword}} text_001 = document.createTextNode(` `);
head_000.appendChild(text_001);
{{keyword}} meta_000 = document.createElement('meta');
meta_000.setAttribute(`charset`, `utf-8`);
head_000.appendChild(meta_000);
{{keyword}} targetElement_001 = document.querySelector(`:root > body`);
{{keyword}} html_001 = document.createElement('html');
{{keyword}} text_001 = document.createTextNode(` `);
html_001.appendChild(text_001);
{{keyword}} head_001 = document.createElement('head');
{{keyword}} text_002 = document.createTextNode(` `);
head_000.appendChild(text_002);
{{keyword}} title_000 = document.createElement('title');
{{keyword}} text_003 = document.createTextNode(`Sample`);
title_000.appendChild(text_003);
head_000.appendChild(title_000);
{{keyword}} text_004 = document.createTextNode(` `);
head_000.appendChild(text_004);
{{keyword}} link_000 = document.createElement('link');
link_000.setAttribute(`rel`, `stylesheet`);
link_000.setAttribute(`href`, ``);
head_000.appendChild(link_000);
{{keyword}} text_005 = document.createTextNode(` `);
head_000.appendChild(text_005);
html_000.appendChild(head_000);
head_001.appendChild(text_002);
{{keyword}} meta_001 = document.createElement('meta');
meta_001.setAttribute(`charset`, `utf-8`);
head_001.appendChild(meta_001);
{{keyword}} text_003 = document.createTextNode(` `);
head_001.appendChild(text_003);
{{keyword}} title_001 = document.createElement('title');
{{keyword}} text_004 = document.createTextNode(`Sample`);
title_001.appendChild(text_004);
head_001.appendChild(title_001);
{{keyword}} text_005 = document.createTextNode(` `);
head_001.appendChild(text_005);
{{keyword}} link_001 = document.createElement('link');
link_001.setAttribute(`rel`, `stylesheet`);
link_001.setAttribute(`href`, ``);
head_001.appendChild(link_001);
{{keyword}} text_006 = document.createTextNode(` `);
html_000.appendChild(text_006);
{{keyword}} body_000 = document.createElement('body');
{{keyword}} text_007 = document.createTextNode(` `);
body_000.appendChild(text_007);
{{keyword}} div_000 = document.createElement('div');
div_000.setAttribute(`id`, `container`);
{{keyword}} text_008 = document.createTextNode(` `);
div_000.appendChild(text_008);
head_001.appendChild(text_006);
html_001.appendChild(head_001);
{{keyword}} text_007 = document.createTextNode(` `);
html_001.appendChild(text_007);
{{keyword}} body_001 = document.createElement('body');
{{keyword}} text_008 = document.createTextNode(` `);
body_001.appendChild(text_008);
{{keyword}} div_001 = document.createElement('div');
div_001.setAttribute(`id`, `header`);
{{keyword}} text_009 = document.createTextNode(` `);
div_001.setAttribute(`id`, `container`);
{{keyword}} text_009 = document.createTextNode(` `);
div_001.appendChild(text_009);
{{keyword}} comment_000 = document.createComment(` Sample H1 `);
div_001.appendChild(comment_000);
{{keyword}} text_010 = document.createTextNode(` `);
div_001.appendChild(text_010);
{{keyword}} h1_000 = document.createElement('h1');
{{keyword}} text_011 = document.createTextNode(`Sample`);
h1_000.appendChild(text_011);
div_001.appendChild(h1_000);
{{keyword}} text_012 = document.createTextNode(` `);
div_001.appendChild(text_012);
{{keyword}} img_000 = document.createElement('img');
img_000.setAttribute(`src`, `kanye.jpg`);
img_000.setAttribute(`alt`, `kanye`);
div_001.appendChild(img_000);
{{keyword}} text_013 = document.createTextNode(` `);
div_001.appendChild(text_013);
div_000.appendChild(div_001);
{{keyword}} text_014 = document.createTextNode(` `);
div_000.appendChild(text_014);
{{keyword}} div_002 = document.createElement('div');
div_002.setAttribute(`id`, `main`);
{{keyword}} text_015 = document.createTextNode(` `);
div_002.appendChild(text_015);
{{keyword}} h2_000 = document.createElement('h2');
{{keyword}} text_016 = document.createTextNode(`Main`);
h2_000.appendChild(text_016);
div_002.appendChild(h2_000);
{{keyword}} text_017 = document.createTextNode(` `);
div_002.appendChild(text_017);
{{keyword}} p_000 = document.createElement('p');
{{keyword}} text_018 = document.createTextNode(`This is the main content.`);
p_000.appendChild(text_018);
div_002.appendChild(p_000);
{{keyword}} text_019 = document.createTextNode(` `);
div_002.appendChild(text_019);
div_002.setAttribute(`id`, `header`);
{{keyword}} text_010 = document.createTextNode(` `);
div_002.appendChild(text_010);
{{keyword}} comment_001 = document.createComment(` Sample H1 `);
div_002.appendChild(comment_001);
{{keyword}} text_011 = document.createTextNode(` `);
div_002.appendChild(text_011);
{{keyword}} h1_001 = document.createElement('h1');
{{keyword}} text_012 = document.createTextNode(`Sample`);
h1_001.appendChild(text_012);
div_002.appendChild(h1_001);
{{keyword}} text_013 = document.createTextNode(` `);
div_002.appendChild(text_013);
{{keyword}} img_001 = document.createElement('img');
img_001.setAttribute(`src`, ``);
img_001.setAttribute(`alt`, ``);
img_001.setAttribute(`src`, `kanye.jpg`);
img_001.setAttribute(`alt`, `kanye`);
div_002.appendChild(img_001);
{{keyword}} text_020 = document.createTextNode(` `);
div_002.appendChild(text_020);
div_000.appendChild(div_002);
{{keyword}} text_021 = document.createTextNode(` `);
div_000.appendChild(text_021);
{{keyword}} text_014 = document.createTextNode(` `);
div_002.appendChild(text_014);
div_001.appendChild(div_002);
{{keyword}} text_015 = document.createTextNode(` `);
div_001.appendChild(text_015);
{{keyword}} div_003 = document.createElement('div');
div_003.setAttribute(`id`, `footer`);
{{keyword}} text_022 = document.createTextNode(` `);
div_003.appendChild(text_022);
{{keyword}} comment_001 = document.createComment(` Copyright `);
div_003.appendChild(comment_001);
{{keyword}} text_023 = document.createTextNode(` `);
div_003.appendChild(text_023);
div_003.setAttribute(`id`, `main`);
{{keyword}} text_016 = document.createTextNode(` `);
div_003.appendChild(text_016);
{{keyword}} h2_001 = document.createElement('h2');
{{keyword}} text_017 = document.createTextNode(`Main`);
h2_001.appendChild(text_017);
div_003.appendChild(h2_001);
{{keyword}} text_018 = document.createTextNode(` `);
div_003.appendChild(text_018);
{{keyword}} p_001 = document.createElement('p');
{{keyword}} text_024 = document.createTextNode(`Copyright © 2019`);
p_001.appendChild(text_024);
{{keyword}} text_019 = document.createTextNode(`This is the main content.`);
p_001.appendChild(text_019);
div_003.appendChild(p_001);
{{keyword}} text_025 = document.createTextNode(` `);
div_003.appendChild(text_025);
div_000.appendChild(div_003);
{{keyword}} text_026 = document.createTextNode(` `);
div_000.appendChild(text_026);
body_000.appendChild(div_000);
{{keyword}} text_027 = document.createTextNode(` `);
body_000.appendChild(text_027);
html_000.appendChild(body_000);
targetElement_000.appendChild(html_000);
{{keyword}} text_020 = document.createTextNode(` `);
div_003.appendChild(text_020);
{{keyword}} img_002 = document.createElement('img');
img_002.setAttribute(`src`, ``);
img_002.setAttribute(`alt`, ``);
div_003.appendChild(img_002);
{{keyword}} text_021 = document.createTextNode(` `);
div_003.appendChild(text_021);
div_001.appendChild(div_003);
{{keyword}} text_022 = document.createTextNode(` `);
div_001.appendChild(text_022);
{{keyword}} div_004 = document.createElement('div');
div_004.setAttribute(`id`, `footer`);
{{keyword}} text_023 = document.createTextNode(` `);
div_004.appendChild(text_023);
{{keyword}} comment_002 = document.createComment(` Copyright `);
div_004.appendChild(comment_002);
{{keyword}} text_024 = document.createTextNode(` `);
div_004.appendChild(text_024);
{{keyword}} p_002 = document.createElement('p');
{{keyword}} text_025 = document.createTextNode(`Copyright © 2019`);
p_002.appendChild(text_025);
div_004.appendChild(p_002);
{{keyword}} text_026 = document.createTextNode(` `);
div_004.appendChild(text_026);
div_001.appendChild(div_004);
{{keyword}} text_027 = document.createTextNode(` `);
div_001.appendChild(text_027);
body_001.appendChild(div_001);
{{keyword}} text_028 = document.createTextNode(` `);
body_001.appendChild(text_028);
html_001.appendChild(body_001);
targetElement_001.appendChild(html_001);
Loading