Skip to content

Commit

Permalink
feat: about page help is generated based on README.md (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
grigoriev authored Jun 25, 2024
1 parent d000c6e commit 9d0fc8c
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 87 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ replay_pid*
target/
*.iml
dependency-reduced-pom.xml

src/main/resources/webapp/*-admin/html/about.html
README.html
26 changes: 26 additions & 0 deletions .scripts/convert-readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -e

INPUT_FILE="${1:-README.md}"
OUTPUT_FILE="${2:-README.html}"

# Convert the markdown file to a JSON payload
jq -R -s '{"mode": "gfm", "text": .}' < "$INPUT_FILE" > payload.json

# Send the JSON payload to the GitHub API
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/markdown \
-d @payload.json > "$OUTPUT_FILE"

# Remove the temporary JSON payload
rm payload.json

# Remove the Build and Installation sections from readme
awk '
/<h2>Build<\/h2>/ {skip=1; next}
/<h2>Polarion configuration<\/h2>/ {skip=0}
!skip' "$OUTPUT_FILE" > "$OUTPUT_FILE.tmp" && mv "$OUTPUT_FILE.tmp" "$OUTPUT_FILE"
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog before migration to conventional commits

| Version | Changes |
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| v1.5.0 | About page extended with help and icon |
| v1.4.0 | * Changed the way of loading attachment content on the page<br/> * Separate endpoints for creating and updating workItem<br/> * Added swagger annotations<br/> * Refactoring<br/> * Update maven dependencies |
| v1.3.0 | * Update polarion version<br/>* Added "about page" for json editor plugin<br/>* Implemented ApiController<br/> * Refactoring<br/>Update maven dependencies |
| v1.2.0 | Initial release |
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This Polarion extension provides possibility to edit JSON files as WorkItem atta
## Build

JSON editor extension can be produced using maven:
```
```bash
mvn clean package
```

Expand Down Expand Up @@ -49,12 +49,3 @@ Changes only take effect after restart of Polarion.
```
8. Save changes by clicking 💾 Save

## Changelog

| Version | Changes |
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| v1.5.0 | About page extended with help and icon |
| v1.4.0 | * Changed the way of loading attachment content on the page<br/> * Separate endpoints for creating and updating workItem<br/> * Added swagger annotations<br/> * Refactoring<br/> * Update maven dependencies |
| v1.3.0 | * Update polarion version<br/>* Added "about page" for json editor plugin<br/>* Implemented ApiController<br/> * Refactoring<br/>Update maven dependencies |
| v1.2.0 | Initial release |
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ch.sbb.polarion.extensions</groupId>
<artifactId>ch.sbb.polarion.extension.generic.parent-pom</artifactId>
<version>4.10.0</version>
<version>4.11.0</version>
</parent>

<artifactId>ch.sbb.polarion.extension.json-editor</artifactId>
Expand Down
Empty file.

This file was deleted.

This file was deleted.

6 changes: 4 additions & 2 deletions src/main/resources/webapp/json-editor-admin/pages/about.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<title></title>
<link rel="stylesheet" href="../ui/generic/css/common.css?bundle=<%= version.getBundleBuildTimestampDigitsOnly() %>">
<link rel="stylesheet" href="../ui/generic/css/about.css?bundle=<%= version.getBundleBuildTimestampDigitsOnly() %>">
<link rel="stylesheet" href="../ui/html/help/configuration.css?bundle=<%= version.getBundleBuildTimestampDigitsOnly() %>">
<link rel="stylesheet" href="../ui/generic/css/github-markdown-light.css?bundle=<%= version.getBundleBuildTimestampDigitsOnly() %>">
</head>

<body>
Expand Down Expand Up @@ -88,13 +88,15 @@

<input id="scope" type="hidden" value="<%= request.getParameter("scope")%>"/>

<article class="markdown-body">
<%
try (InputStream inputStream = ExtensionInfo.class.getResourceAsStream("/webapp/json-editor-admin/html/help/configuration.html")) {
try (InputStream inputStream = ExtensionInfo.class.getResourceAsStream("/webapp/json-editor-admin/html/about.html")) {
assert inputStream != null;
String configurationHelp = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
out.println(configurationHelp);
}
%>
</article>
</div>
</div>
</body>
Expand Down

0 comments on commit 9d0fc8c

Please sign in to comment.