Skip to content

Commit 6eb1de4

Browse files
committed
Update the repository file for 0.3.0
1 parent 49d38d8 commit 6eb1de4

File tree

3 files changed

+2637
-1460
lines changed

3 files changed

+2637
-1460
lines changed

repository/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# Repository
22

33
This folder contains the repostiory of the WPM ([Webstrates Package Manager](https://codestrates.projects.cavi.au.dk/docs/guide/webstrates-package-manager/)) packages of Spatialstrates.
4+
5+
6+
## Updating the Repository File
7+
8+
To update the repository file, run the `update-repo-file.sh` script. The script takes the current `index.html` file from the prototype and removes all unnecessary elements.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Get the script's directory
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
SOURCE_FILE="$SCRIPT_DIR/../prototypes/spatialstrate/index.html"
6+
TARGET_FILE="$SCRIPT_DIR/spatialstrates.html"
7+
8+
if [ ! -f "$SOURCE_FILE" ]; then
9+
echo "Error: $SOURCE_FILE not found"
10+
exit 1
11+
fi
12+
13+
# Copy the file
14+
echo "Copying $SOURCE_FILE to $TARGET_FILE"
15+
cp "$SOURCE_FILE" "$TARGET_FILE"
16+
17+
# Clean the file
18+
echo "Cleaning file: $TARGET_FILE"
19+
perl -0777 -pi -e '
20+
# Remove the entire <head> element and its contents
21+
s/<head[^>]*>.*?<\/head>//gs;
22+
23+
# Remove <code-folder name="WPM"> element and its contents
24+
s/<code-folder\s+name="WPM"[^>]*>.*?<\/code-folder>//gs;
25+
26+
# Remove <code-folder name="Meta Elements"> element and its contents
27+
s/<code-folder\s+name="Meta Elements"[^>]*>.*?<\/code-folder>//gs;
28+
29+
# Remove <code-folder id="vis-component-container"> element and its contents
30+
s/<code-folder\s+class="dataset-container"[^>]*>.*?<\/code-folder>//gs;
31+
s/<code-folder\s+class="spec-container"[^>]*>.*?<\/code-folder>//gs;
32+
s/<code-folder\s+id="vis-component-container"[^>]*>.*?<\/code-folder>//gs;
33+
34+
# Remove <code-fragment data-type="text/markdown" name="AGENTS"> element and its contents
35+
s/<code-fragment\s+data-type="text\/markdown"\s+name="AGENTS"[^>]*>.*?<\/code-fragment>//gs;
36+
' "$TARGET_FILE"
37+
38+
echo "Output file: $TARGET_FILE"
39+
echo "Done."

0 commit comments

Comments
 (0)