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

feat: about page help is generated based on README.md #6

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading