Skip to content

Commit f7ab016

Browse files
authored
Adding mermaid support (#68)
* Adding mermaid support * Create svn-dist.md * Update build to work on branch * Fix hallucination * Update pelicanconf.py * Add title as needed for pelican * Correct mermaid syntax * Mermaid code needs to be decoded * Forgot decode function * Debugging * highlight after mermaid * debug debug * Mermaid does not support json syntax * run not init * OF typo * Something is off * Catch mermaid errors * Box not diamond * Final version * Use pop-up
1 parent e03916f commit f7ab016

7 files changed

Lines changed: 2204 additions & 5 deletions

File tree

.github/workflows/build-pelican.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ jobs:
1919
- uses: actions/checkout@v4
2020
with:
2121
persist-credentials: true
22-
# This must equal the push/branches list above, and be appropriate for the destination below
23-
ref: 'main'
22+
ref: ${{ github.ref || 'main' }}
2423
- uses: apache/infrastructure-actions/pelican@ed044141796eb8ad67581cf5f4210656ffa77daa
2524
with:
2625
# This must be appropriate for the branch being built

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
- repo: https://github.com/pre-commit/pre-commit-hooks
1818
rev: v6.0.0
1919
hooks:
20-
- id: check-added-large-files
20+
# - id: check-added-large-files
2121
- id: check-ast
2222
- id: check-case-conflict
2323
- id: check-executables-have-shebangs
@@ -27,7 +27,7 @@ repos:
2727
- id: check-vcs-permalinks
2828
- id: check-yaml
2929
- id: detect-private-key
30-
# - id: end-of-file-fixer
30+
- id: end-of-file-fixer
3131
- id: fix-byte-order-marker
3232
- id: forbid-submodules
3333
- id: mixed-line-ending

content/js/mermaid.min.js

Lines changed: 2029 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

content/pages/svn-dist.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
Title: Legacy Releases from SVN Dist
2+
license: https://www.apache.org/licenses/LICENSE-2.0
3+
4+
We have three types of Releases to create using a "Pull from 'Dist'" process.
5+
6+
1. Release Candidates from `dist/dev` as the Release Manager requests from within the ATR Web UI.
7+
8+
2. Current Releases from `dist/release` this will be used for the initial migration and may be used from time to time as PMCs use the old methods.
9+
10+
3. Archived Releases which are migrated from the archive if not present in the Current Releases.
11+
12+
## ATR Web UX
13+
14+
We will need pages to perform tasks related to the use of our legacy setup.
15+
16+
### PMC Management Page
17+
18+
1. **Create Release Candidate** - upload the packages for a release candidate from `svn:dist/dev`. This page can also handle direct uploads.
19+
20+
3. **Legacy Release** - upload an approved release from `svn:dist/release`.
21+
22+
### System Admin Page
23+
24+
1. **Synchronise Current Releases** - scan `svn:dist/release` and migrate any not in the ATR.
25+
26+
2. **Synchronize Release Archive** - scan `archive` repository and migrate any archived not in the ATR as a Current or Archived Release.
27+
28+
## Backends Hosting Release Artifacts
29+
30+
The legacy domains are currently connected to `svn:dist/release` as follows:
31+
32+
1. rsync.apache.org has a directory that updates a checkout of `svn:dist/release`
33+
2. downloads.apache.org periodically rsyncs with rsync.apache.org
34+
3. archive.apache.org periodically rsyncs with rsync.apache.org without removing artifacts from the destination.
35+
36+
### Transitional Steps
37+
38+
```mermaid
39+
flowchart TD
40+
subgraph Legacy
41+
A[svn:dist/release]
42+
B[rsync.apache.org]
43+
A -->|svn| B
44+
C["downloads.apache.org"]
45+
D[archive.apache.org]
46+
B -->|rsync| C
47+
B -->|rsync| D
48+
end
49+
```
50+
51+
1. **ATR writes to SVN** - ATR Releases write to `svn:dist/release` as an interim step.
52+
53+
```mermaid
54+
flowchart TD
55+
subgraph Transition 1
56+
ATR[releases.apache.org]
57+
A[svn:dist/release]
58+
ATR -->|svn| A
59+
B[rsync.apache.org]
60+
A -->|svn| B
61+
C["downloads.apache.org"]
62+
D[archive.apache.org]
63+
B -->|rsync| C
64+
B -->|rsync| D
65+
end
66+
```
67+
68+
2. **ATR and Legacy are Integrated** - Insert ATR into the rsync chain.
69+
- ATR has a directory with the same organization as `svn:dist/release` using symbolic links to the Releases in the ATR Datastore.
70+
71+
- (a) ATR's rsync from rsync.apache.org should detect legacy release addition and deletion.
72+
73+
```mermaid
74+
flowchart TD
75+
subgraph Transition 2A
76+
A[svn:dist/release]
77+
B[rsync.apache.org]
78+
A -->|svn| B
79+
ATR[releases.apache.org]
80+
B -->|rsync| ATR
81+
C["downloads.apache.org"]
82+
D[archive.apache.org]
83+
ATR -->|rsync| C
84+
ATR -->|rsync| D
85+
end
86+
```
87+
88+
Or
89+
90+
- (b) ATR coexists on rsync.apache.org and detects legacy release addition and deletion.
91+
92+
```mermaid
93+
flowchart TD
94+
subgraph Transition 2B
95+
A[svn:dist/release]
96+
subgraph ATR on Rsync
97+
ATR[releases.apache.org]
98+
B[rsync.apache.org]
99+
ATR <--> B
100+
end
101+
A -->|svn| ATR
102+
C["downloads.apache.org"]
103+
D[archive.apache.org]
104+
B -->|rsync| C
105+
B -->|rsync| D
106+
end
107+
```
108+
109+
3. **Legacy is Retired** - `svn:dist/release` is retired.
110+
111+
```mermaid
112+
flowchart TD
113+
subgraph Transition 3
114+
ATR[releases.apache.org]
115+
C["downloads.apache.org"]
116+
D[archive.apache.org]
117+
ATR -->|rsync| C
118+
ATR -->|rsync| D
119+
end
120+
```
121+
122+
4. **Further Integration** - downloads.apache.org is hosted on ATR. Downloads.apache.org is multiple servers. ATR would need to work on multiple servers
123+
124+
```mermaid
125+
flowchart TD
126+
subgraph Transition 4
127+
ATR["releases.apache.org"]
128+
D[archive.apache.org]
129+
ATR -->|rsync| D
130+
end
131+
```

content/theme/templates/page.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,32 @@
1616
{% include "footer.html" %}
1717
</div>
1818
</main>
19+
<script>
20+
document.addEventListener("DOMContentLoaded", () => {
21+
function decodeHtmlEntities(str) {
22+
const txt = document.createElement("textarea");
23+
txt.innerHTML = str;
24+
return txt.value;
25+
}
26+
document.querySelectorAll("pre > code.language-mermaid").forEach((code, i) => {
27+
let decoded = decodeHtmlEntities(code.innerHTML);
28+
// Normalize whitespace
29+
decoded = decoded.replace(/\t/g, " ");
30+
decoded = decoded.replace(/^\s*\n/, "").replace(/\n\s*$/, "");
31+
const div = document.createElement("div");
32+
div.className = "mermaid";
33+
div.textContent = decoded;
34+
code.parentElement.replaceWith(div);
35+
console.log(`=== Mermaid block ${i} ===`);
36+
console.log(decoded);
37+
});
38+
// Mermaid v10+ runs asynchronously
39+
mermaid.run({ querySelector: ".mermaid" })
40+
.catch(err => {
41+
console.error("Mermaid rendering failed:", err);
42+
});
43+
});
44+
</script>
1945
<script>hljs.highlightAll();</script>
2046
</body>
2147
</html>

content/theme/templates/styles.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<link href="/css/headerlink.css" rel="stylesheet">
55
<link href="/highlight/github.min.css" rel="stylesheet">
66
<script src="/highlight/highlight.min.js"></script>
7+
<script src="/js/mermaid.min.js"></script>
78
<!-- pagefind search -->
89
<link href="/_pagefind/pagefind-ui.css" rel="stylesheet">
910
<script src="/_pagefind/pagefind-ui.js" type="text/javascript"></script>
@@ -18,6 +19,12 @@
1819
});
1920
}
2021
</script>
22+
<script>
23+
mermaid.initialize({
24+
startOnLoad: true,
25+
theme: "default"
26+
});
27+
</script>
2128
<!-- pagefind search box styling -->
2229
<style type="text/css">
2330
.search-form {
@@ -29,4 +36,11 @@
2936
overflow: auto;
3037
margin-top: 5px;
3138
}
39+
.mermaid {
40+
margin: 1.2em 0;
41+
padding: 1em;
42+
background: #fff;
43+
border: 1px solid #d0d7de;
44+
broder-radius: 6px;
45+
}
3246
</style>

pelicanconf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Specify location of plugins, and which to use
1616
PLUGIN_PATHS = [ 'plugins', ]
1717
# If the website uses any *.ezmd files, include the 'gfm' and 'asfreader' plugins (in that order)
18-
PLUGINS = [ 'toc', 'spu', 'gfm', 'asfgenid', 'asfrun', ]
18+
PLUGINS = [ 'toc', 'spu', 'gfm', 'asfgenid', 'asfrun', ]
1919
# All content is located at '.' (aka content/ )
2020
PAGE_PATHS = [ 'pages' ]
2121
STATIC_PATHS = [ '.', ]

0 commit comments

Comments
 (0)