mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
Collapse word studies by default, show only word + Greek term
Word study sidenotes now show just the word and Greek/Hebrew term by default. Click to expand and reveal transliteration and full definition. Adds a subtle ▸ indicator showing the sidenote can be expanded. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -147,7 +147,11 @@ def link_verse_references_in_text(text):
|
||||
|
||||
|
||||
def inject_word_markers(text, word_studies, verse_num):
|
||||
"""Inject sidenote markers into verse text next to annotated words"""
|
||||
"""Inject sidenote markers into verse text next to annotated words.
|
||||
|
||||
Word studies are collapsed by default, showing only the word and Greek/Hebrew term.
|
||||
Clicking expands to show transliteration and full definition.
|
||||
"""
|
||||
if not word_studies:
|
||||
return text
|
||||
|
||||
@@ -159,7 +163,15 @@ def inject_word_markers(text, word_studies, verse_num):
|
||||
term_html = f'<a href="/strongs/{strongs}">{study["term"]}</a>'
|
||||
else:
|
||||
term_html = study["term"]
|
||||
marker = f'<label for="sn-{verse_num}-word-{idx}" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-{verse_num}-word-{idx}" class="margin-toggle"/><span class="sidenote"><strong>{word}:</strong> {term_html} (<em>{study["translit"]}</em>). {study["note"]}</span>'
|
||||
# Wrap details (translit + note) in a span that's hidden by default
|
||||
marker = (
|
||||
f'<label for="sn-{verse_num}-word-{idx}" class="margin-toggle sidenote-number"></label>'
|
||||
f'<input type="checkbox" id="sn-{verse_num}-word-{idx}" class="margin-toggle"/>'
|
||||
f'<span class="sidenote word-study">'
|
||||
f'<strong>{word}:</strong> {term_html}'
|
||||
f'<span class="word-study-details"> (<em>{study["translit"]}</em>). {study["note"]}</span>'
|
||||
f'</span>'
|
||||
)
|
||||
pattern = re.compile(r'\b(' + re.escape(word) + r')(?!\'[sS])\b', re.IGNORECASE)
|
||||
text = pattern.sub(r'\1' + marker, text, count=1)
|
||||
|
||||
|
||||
@@ -101,6 +101,32 @@
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
/* Word studies: collapsed by default, show only word + Greek term */
|
||||
.sidenote.word-study {
|
||||
max-height: none;
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sidenote.word-study .word-study-details {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidenote.word-study.expanded .word-study-details {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Show expand indicator for collapsed word studies */
|
||||
.sidenote.word-study:not(.expanded)::after {
|
||||
content: " ▸";
|
||||
font-size: 0.8em;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.sidenote.word-study.expanded::after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.sidenote,
|
||||
.marginnote {
|
||||
|
||||
Reference in New Issue
Block a user