-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDhammapada_Reader.html
More file actions
225 lines (194 loc) · 7.82 KB
/
Copy pathDhammapada_Reader.html
File metadata and controls
225 lines (194 loc) · 7.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>The Digital Dhammapada</title>
<style>
:root {
--buddhist-saffron: #f4a460;
--stoic-red: #8b1a1a;
--bg-paper: #f9f7f1;
--border-tan: #e0d7c6;
--text-main: #2c2c2c;
--accent-gold: #d4af37;
}
body {
margin: 0; padding: 0;
font-family: 'Constantia', 'Georgia', serif;
background-color: var(--bg-paper);
color: var(--text-main);
display: flex; flex-direction: column;
/* Changed to min-height to allow for scrolling down to the footer */
min-height: 100vh;
}
header {
text-align: center; padding: 15px;
background-color: white;
border-bottom: 4px solid var(--buddhist-saffron);
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
flex-shrink: 0;
}
header h1 { margin: 0; font-variant: small-caps; letter-spacing: 2px; }
.controls {
text-align: center; padding: 12px;
background: #fff; border-bottom: 1px solid var(--border-tan);
display: flex; justify-content: center; gap: 20px; align-items: center;
position: sticky; top: 0; z-index: 10;
}
select {
padding: 8px 16px; font-family: serif; border: 1px solid var(--border-tan);
border-radius: 4px; background: #fff; cursor: pointer; font-size: 1rem;
}
main {
display: grid;
grid-template-columns: 1fr 1.2fr;
grid-template-rows: auto 450px; /* Fixed height for the commentary area */
gap: 15px; padding: 20px;
flex: 1;
}
.pane {
background: #fff; border: 1px solid var(--border-tan);
padding: 25px; border-radius: 4px;
box-shadow: 0 2px 8px rgba(0,0,0,0.02);
display: flex; flex-direction: column;
overflow-y: auto;
}
.pane h2 {
margin-top: 0; font-size: 0.85rem; text-transform: uppercase;
letter-spacing: 1.5px; border-bottom: 1px solid #eee;
padding-bottom: 8px; margin-bottom: 15px;
}
.pali-header { color: var(--buddhist-saffron); }
.english-header { color: var(--accent-gold); }
.stoic-header { color: var(--stoic-red); }
#paliText { font-style: italic; font-size: 1.3rem; line-height: 1.6; color: #555; text-align: center; margin: auto; }
#englishText { font-size: 1.25rem; line-height: 1.6; font-weight: 500; text-align: center; margin: auto; }
.commentary-pane {
grid-column: span 2;
border-top: 3px solid var(--stoic-red);
background-color: #fdfdfd;
}
#commentaryContent { font-size: 1.1rem; line-height: 1.7; color: #444; }
.stoic-term {
color: var(--stoic-red);
font-weight: normal;
font-style: italic;
}
footer {
padding: 80px 20px;
border-top: 1px solid var(--border-tan);
background: #fff;
text-align: center;
font-size: 0.85rem;
color: #666;
flex-shrink: 0;
margin-top: 40px;
}
@media (max-width: 900px) {
main { grid-template-columns: 1fr; grid-template-rows: auto auto auto; overflow-y: auto; }
.commentary-pane { grid-column: span 1; }
}
</style>
</head>
<body>
<header>
<h1>The Digital Dhammapada</h1>
<p>A Stoic-Buddhist Comparative Reader</p>
</header>
<div class="controls">
<div>
<label>Verse Select: </label>
<select id="verseSelect"></select>
</div>
</div>
<main>
<div class="pane">
<h2 class="pali-header">Pali Verse</h2>
<div id="paliText"></div>
</div>
<div class="pane">
<h2 class="english-header">English Translation</h2>
<div id="englishText"></div>
</div>
<div class="pane commentary-pane">
<h2 class="stoic-header">Stoic Commentary</h2>
<div id="commentaryContent"></div>
</div>
</main>
<footer>
<div style="max-width: 800px; margin: 0 auto;">
<h3 style="text-transform: uppercase; letter-spacing: 1px; color: var(--text-main); font-size: 0.8rem; margin-bottom: 15px;">Citation Information</h3>
<p style="line-height: 1.6;">
Moss, W.N. (2026). <em>The Digital Dhammapada: A Stoic-Buddhist Comparative Edition</em>.
Zenodo. <a href="https://doi.org/10.5281/zenodo.18829402" target="_blank" style="color: var(--stoic-red); text-decoration: none; font-weight: bold;">https://doi.org/10.5281/zenodo.18829402</a>
</p>
<hr style="width: 50px; border: 0; border-top: 1px solid var(--border-tan); margin: 25px auto;">
<p style="font-style: italic;">
Pali source text provided by SuttaCentral (Bilara-data). Computational translation and
commentary generated via the Symmetry of Wisdom pipeline.
</p>
<p>© 2026 Walter N. Moss. Distributed under CC BY 4.0.</p>
</div>
</footer>
<script>
let dhpData = [];
const stoicTerms = [
"physis", "holos", "kosmos", "hegemonikon", "psyche", "logos",
"anthropos", "theos", "kakos", "phantasia", "polis", "arete",
"adiaphoros", "eudaimonia", "pneuma", "apatheia",
"synkatathesis", "proairesis", "kalos"
];
async function init() {
try {
const response = await fetch('./dhp_with_stoic_commentary.json');
if (!response.ok) {
throw new Error(`HTTP Error: ${response.status}`);
}
dhpData = await response.json();
setupSelector();
render(dhpData[0].ref);
} catch (err) {
console.error("Reader Error:", err);
document.querySelector('main').innerHTML = `
<div style="grid-column: span 2; padding:50px; text-align:center; font-family:serif;">
<h2 style="color:var(--stoic-red);">Reader Connection Error</h2>
<p>The server is responding, but could not load the data.</p>
<p style="background:#fff1f1; padding:10px; display:inline-block; border:1px solid #ffcccc;">
<code>${err.message}</code>
</p>
<br><br>
<button onclick="location.reload()" style="padding:10px 20px; cursor:pointer;">Retry Connection</button>
</div>`;
}
}
function setupSelector() {
const selector = document.getElementById('verseSelect');
selector.innerHTML = '';
dhpData.forEach(entry => {
const opt = document.createElement('option');
opt.value = entry.ref;
opt.textContent = entry.ref;
selector.appendChild(opt);
});
selector.onchange = (e) => render(e.target.value);
}
function highlightStoicTerms(text) {
if (!text || typeof text !== 'string') return "<em>Stoic commentary pending for this verse.</em>";
let highlighted = text;
stoicTerms.forEach(term => {
const re = new RegExp(`\\b${term}\\b`, 'gi');
highlighted = highlighted.replace(re, `<span class="stoic-term">$&</span>`);
});
return highlighted;
}
function render(refId) {
const entry = dhpData.find(v => v.ref === refId);
if (!entry) return;
document.getElementById('paliText').textContent = entry.pali || "";
document.getElementById('englishText').textContent = entry.english || "";
document.getElementById('commentaryContent').innerHTML = highlightStoicTerms(entry.stoic_commentary);
}
window.onload = init;
</script>
</body>
</html>