Skip to content

Commit

Permalink
fix(java): Escape */ in package-info.java (#526)
Browse files Browse the repository at this point in the history
Code examples in the `README.md` file can contain multi-line comments
that will interfere with the comment block in `package-info.java`.
Escaping the `*/` to `*{@literal /}` fixes that issue.
  • Loading branch information
RomainMuller authored and rix0rrr committed Jun 7, 2019
1 parent 7ffa98d commit 4e7ea98
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/codemaker/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions packages/jsii-calc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this
heading will be used as the Sphinx topic name. Otherwise, the name of the module
(`jsii-calc`) will be used instead.

## Code Samples



```ts
/* This is totes a magic comment in here, just you wait! */
const foo = 'bar';
```
4 changes: 2 additions & 2 deletions packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
},
"name": "jsii-calc",
"readme": {
"markdown": "# jsii Calculator\n\nThis library is used to demonstrate and test the features of JSII\n\n## Sphinx\n\nThis file will be incorporated into the sphinx documentation.\n\nIf this file starts with an \"H1\" line (in our case `# jsii Calculator`), this\nheading will be used as the Sphinx topic name. Otherwise, the name of the module\n(`jsii-calc`) will be used instead.\n\n\n\n\n"
"markdown": "# jsii Calculator\n\nThis library is used to demonstrate and test the features of JSII\n\n## Sphinx\n\nThis file will be incorporated into the sphinx documentation.\n\nIf this file starts with an \"H1\" line (in our case `# jsii Calculator`), this\nheading will be used as the Sphinx topic name. Otherwise, the name of the module\n(`jsii-calc`) will be used instead.\n\n## Code Samples\n\n```ts\n/* This is totes a magic comment in here, just you wait! */\nconst foo = 'bar';\n```\n"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -8604,5 +8604,5 @@
}
},
"version": "0.11.1",
"fingerprint": "uCNbkp5+1duLs9lW2h4C+T4dTtV6ZArNhzgT39ChGpk="
"fingerprint": "9L8/rsLS+UYbDYN+YX0Wb3gybgQNUCyFdD52GKTWEs0="
}
2 changes: 1 addition & 1 deletion packages/jsii-diff/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-dotnet-jsonmodel/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-dotnet-runtime-test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-dotnet-runtime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-java-runtime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-kernel/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-pacmak/lib/targets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class JavaGenerator extends Generator {
this.code.line('/**');
if (mod.readme) {
for (const line of md2html(mod.readme.markdown).split('\n')) {
this.code.line(` * ${line}`);
this.code.line(` * ${line.replace(/\*\//g, '*{@literal /}')}`);
}
}
if (mod.docs.deprecated) {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
},
"name": "jsii-calc",
"readme": {
"markdown": "# jsii Calculator\n\nThis library is used to demonstrate and test the features of JSII\n\n## Sphinx\n\nThis file will be incorporated into the sphinx documentation.\n\nIf this file starts with an \"H1\" line (in our case `# jsii Calculator`), this\nheading will be used as the Sphinx topic name. Otherwise, the name of the module\n(`jsii-calc`) will be used instead.\n\n\n\n\n"
"markdown": "# jsii Calculator\n\nThis library is used to demonstrate and test the features of JSII\n\n## Sphinx\n\nThis file will be incorporated into the sphinx documentation.\n\nIf this file starts with an \"H1\" line (in our case `# jsii Calculator`), this\nheading will be used as the Sphinx topic name. Otherwise, the name of the module\n(`jsii-calc`) will be used instead.\n\n## Code Samples\n\n```ts\n/* This is totes a magic comment in here, just you wait! */\nconst foo = 'bar';\n```\n"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -8604,5 +8604,5 @@
}
},
"version": "0.11.1",
"fingerprint": "uCNbkp5+1duLs9lW2h4C+T4dTtV6ZArNhzgT39ChGpk="
"fingerprint": "9L8/rsLS+UYbDYN+YX0Wb3gybgQNUCyFdD52GKTWEs0="
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* <p>If this file starts with an &quot;H1&quot; line (in our case <code># jsii Calculator</code>), this
* heading will be used as the Sphinx topic name. Otherwise, the name of the module
* (<code>jsii-calc</code>) will be used instead.</p>
* <h2>Code Samples</h2>
* <pre><code class="language-ts">/* This is totes a magic comment in here, just you wait! *{@literal /}
* const foo = 'bar';
* </code></pre>
*
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
Expand Down
7 changes: 5 additions & 2 deletions packages/jsii-pacmak/test/expected.jsii-calc/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this
heading will be used as the Sphinx topic name. Otherwise, the name of the module
(`jsii-calc`) will be used instead.

## Code Samples



```ts
/* This is totes a magic comment in here, just you wait! */
const foo = 'bar';
```

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this
heading will be used as the Sphinx topic name. Otherwise, the name of the module
(`jsii-calc`) will be used instead.

## Code Samples



```ts
/* This is totes a magic comment in here, just you wait! */
const foo = 'bar';
```

2 changes: 1 addition & 1 deletion packages/jsii-reflect/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-ruby-runtime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-runtime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii-spec/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/jsii/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/oo-ascii-tree/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4e7ea98

Please sign in to comment.