Skip to content

Commit ddcc060

Browse files
committed
added json values and adjusted display
1 parent 4965794 commit ddcc060

6 files changed

Lines changed: 66 additions & 15 deletions

File tree

‎about.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<head>
33
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
44

5-
<title data-template="app:record-title">App Title</title>
5+
<title >BLSB</title>
66

77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
88

‎dev-browse.html‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@
2626
.noUi-handle { display: none; }
2727
.noUi-horizontal { height: 8px; }
2828

29+
/* Navbar font and icon sizing */
30+
.navbar-brand { font-size: 24px; line-height: 50px; height: 50px; padding: 0 15px; display: flex; align-items: center; }
31+
.banner-icon { font-size: 40px; margin-right: 10px; }
32+
.banner-text { font-size: 24px; }
33+
.nav-text { font-size: 18px; }
34+
.navbar-nav > li > a { font-size: 18px; line-height: 50px; padding-top: 0; padding-bottom: 0; }
35+
2936
footer { text-align: center; }
3037
</style>
3138
</head>
3239
<body>
33-
<script src="resources/js/jquery.min.js"></script>
34-
<script src="resources/js/navbar-search.js"></script>
40+
<script src="/resources/js/jquery.min.js"></script>
41+
<script src="/resources/js/navbar-search.js"></script>
3542
<div id="navbar-container"></div>
3643
<div class="container-fluid">
3744
<div class="row">

‎favicon.ico‎

-13.6 KB
Binary file not shown.

‎resources/js/search.js‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ function displayResults(results, page = 1, perPage = 20) {
7878
const html = pageResults.map((item, index) => {
7979
const formatValue = (val, key) => {
8080
if (!Array.isArray(val)) return val;
81-
const periodFields = ['title', 'displayTitleEnglish'];
81+
const periodFields = ['title'];
8282
return periodFields.includes(key) ? val.join('. ') : val.join(', ');
8383
};
8484

85-
const titleFields = ['titleStmt', 'msItemTitle', 'rubric', 'syrTitle'];
85+
const titleFields = ['msItemTitle'];
8686
const allTitles = [];
8787
titleFields.forEach(field => {
8888
if (item[field]) {
@@ -102,15 +102,21 @@ function displayResults(results, page = 1, perPage = 20) {
102102

103103
return `
104104
<div class="result-item" style="padding:15px; border:1px solid #ddd; margin-bottom:10px; border-radius:5px;">
105-
${item.displayTitleEnglish ? `<p>${formatValue(item.displayTitleEnglish, 'displayTitleEnglish')}</p>` : ''}
106-
${contentSummary ? `<p><strong>Content:</strong> <span class="content-text" id="content-${index}">${displayContent}${truncated ? '...' : ''}</span>${truncated ? ` <a href="#" class="show-more" data-index="${index}" data-full="${contentSummary.replace(/"/g, '&quot;')}">Show more</a>` : ''}</p>` : ''}
107-
<p><strong>Shelfmark:</strong> ${formatValue(item.shelfmark, 'shelfmark') || 'N/A'}</p>
105+
${item.displayTitleEnglish ? `<p>${formatValue(item.displayTitleEnglish, 'displayTitleEnglish')} </p>` : ''}
106+
${item.wrightNum ? `<p>${formatValue(item.wrightNum, 'wrightNum')} </p>` : ''}
107+
108108
<p>URL: <a href="${msUrl}" target="_blank">${msUrl}</a></p>
109-
<small class="text-muted">
110-
${item.material ? `Material: ${formatValue(item.material, 'material')} | ` : ''}
111-
${item.scriptLanguage ? `Script: ${item.scriptLanguage} | ` : ''}
112-
${item.classification ? `Classification: ${formatValue(item.classification, 'classification')}` : ''}
113-
</small>
109+
<p>${item.origDate ? `${formatValue(item.origDate, 'origDate')}` : ''}${item.origPlace ? ` | ${formatValue(item.origPlace, 'origPlace')}` : ''}</p>
110+
<p class="text-muted">
111+
${item.scriptLanguage ? `Script: ${item.scriptLanguage} | ` : ''}
112+
${item.material ? `| ${formatValue(item.material, 'material')} | ` : ''}
113+
${item.form ? ` ${formatValue(item.form, 'material')} | ` : ''}
114+
${item.extent ? `| ${formatValue(item.extent, 'extent')} | ` : ''}
115+
</p>
116+
117+
<p><strong>Shelfmark:</strong> ${formatValue(item.shelfmark, 'shelfmark') || 'N/A'}</p>
118+
${item.classification ? `Classification: ${formatValue(item.classification, 'classification')}` : ''}
119+
114120
</div>
115121
`;
116122
}).join('');

‎tei2json.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ def extract_json(tree):
116116
# summary: from msContents/summary or profileDesc/abstract
117117
summary = first_text(root, ".//tei:msContents/tei:summary | .//tei:profileDesc/tei:abstract")
118118

119+
# contents note: from head/note[@type='contents-note']
120+
contents_note = first_text(root, ".//tei:head/tei:note[@type='contents-note']")
121+
119122
# persName: collect person names in tei:persName nodes (serialize inner markup if present)
120123
pers_nodes = root.xpath(".//tei:persName", namespaces=NS)
121124
pers_list = []
@@ -134,6 +137,11 @@ def extract_json(tree):
134137
# shelfmark: altIdentifier idno type=BL-Shelfmark or altIdentifier/ idno content
135138
shelfmarks = text_list(root, ".//tei:altIdentifier/tei:idno[@type='BL-Shelfmark'] | .//tei:altIdentifier/tei:idno | .//tei:msIdentifier//tei:idno[@type='BL-Shelfmark']")
136139

140+
# Wright entry number: from msIdentifier/altIdentifier/idno[@type='Wright-BL-Roman']
141+
wright_num = first_text(root, ".//tei:msIdentifier//tei:altIdentifier//tei:idno[@type='Wright-BL-Roman']")
142+
if wright_num:
143+
wright_num = f"[Wright {wright_num}]"
144+
137145
# finalRubrics
138146
final_rubrics = []
139147
for el in root.xpath(".//tei:finalRubric", namespaces=NS):
@@ -172,6 +180,14 @@ def extract_json(tree):
172180
else:
173181
material = first_text(root, ".//tei:physDesc//tei:objectDesc//tei:supportDesc//tei:material | .//tei:objectDesc//tei:supportDesc//tei:material | .//tei:physDesc//tei:supportDesc//tei:material | .//tei:physDesc//tei:supportDesc//tei:support//tei:material")
174182

183+
# form: from physDesc/objectDesc/@form, capitalized
184+
form = first_text(root, ".//tei:physDesc//tei:objectDesc/@form")
185+
if form:
186+
form = form.capitalize()
187+
188+
# extent: from physDesc/objectDesc/supportDesc/extent/measure (text or @quantity)
189+
extent = first_text(root, ".//tei:physDesc//tei:objectDesc//tei:supportDesc//tei:extent//tei:measure")
190+
175191
# classification: collect descs under listRelation or relation descs (e.g., "Old Testament")
176192
classification = text_list(root, ".//tei:listRelation//tei:relation/tei:desc | .//tei:listRelation//tei:desc | .//tei:listRelation//tei:relation/tei:desc")
177193

@@ -206,16 +222,20 @@ def extract_json(tree):
206222
if idno: out["idno"] = idno
207223
out["displayTitleEnglish"] = display_title_english or ""
208224
if summary: out["summary"] = summary
225+
if contents_note: out["contentsNote"] = contents_note
209226
if pers_list: out["persName"] = pers_list
210227
if place_list: out["placeName"] = place_list
211228
if origin_place_list: out["origPlace"] = origin_place_list
212229
if shelfmarks: out["shelfmark"] = shelfmarks
230+
if wright_num: out["wrightEntry"] = wright_num
213231
if final_rubrics: out["finalRubrics"] = final_rubrics
214232
if colophons: out["colophons"] = colophons
215233
if other_limit: out["otherLimit"] = other_limit
216234
if script_val: out["script"] = script_val
217235
if script_lang: out["scriptLanguage"] = script_lang
218236
if material: out["material"] = material
237+
if form: out["form"] = form
238+
if extent: out["extent"] = extent
219239
if classification: out["classification"] = classification
220240
if orig_dates: out["origDate"] = orig_dates
221241
if date_not_before: out["dateNotBefore"] = date_not_before

‎teiParts2json.py‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def extract_json(tree, part_node=None):
147147

148148
# shelfmark: altIdentifier idno type=BL-Shelfmark or altIdentifier/ idno content
149149
# For parts, inherit from document root if not found in part
150-
shelfmarks = text_list(root, ".//tei:altIdentifier/tei:idno[@type='BL-Shelfmark'] | .//tei:altIdentifier/tei:idno | .//tei:msIdentifier//tei:idno[@type='BL-Shelfmark']")
150+
shelfmarks = text_list(root, ".//tei:altIdentifier/tei:idno[@type='BL-Shelfmark-display']")
151151
if not shelfmarks and part_node is not None:
152-
shelfmarks = text_list(doc_root, ".//tei:altIdentifier/tei:idno[@type='BL-Shelfmark'] | .//tei:altIdentifier/tei:idno | .//tei:msIdentifier//tei:idno[@type='BL-Shelfmark']")
152+
shelfmarks = text_list(doc_root, ".//tei:altIdentifier/tei:idno[@type='BL-Shelfmark-display'] ")
153153

154154
# finalRubrics
155155
final_rubrics = []
@@ -188,6 +188,20 @@ def extract_json(tree, part_node=None):
188188
material = MATERIALS_MAP.get(material_attr, material_attr)
189189
else:
190190
material = first_text(root, ".//tei:physDesc//tei:objectDesc//tei:supportDesc//tei:material | .//tei:objectDesc//tei:supportDesc//tei:material | .//tei:physDesc//tei:supportDesc//tei:material | .//tei:physDesc//tei:supportDesc//tei:support//tei:material")
191+
192+
# form: from physDesc/objectDesc/@form, capitalized
193+
form = first_text(root, ".//tei:physDesc//tei:objectDesc/@form")
194+
if form:
195+
form = form.capitalize()
196+
197+
# extent: from physDesc/objectDesc/supportDesc/extent/measure (text or @quantity)
198+
extent = first_text(root, ".//tei:physDesc//tei:objectDesc//tei:supportDesc//tei:extent//tei:measure")
199+
# Wright entry number: from msIdentifier/altIdentifier/idno[@type='Wright-BL-Roman']
200+
wright_num = first_text(root, ".//tei:msIdentifier//tei:altIdentifier//tei:idno[@type='Wright-BL-Roman']")
201+
if wright_num:
202+
wright_num = f"[Wright {wright_num}]"
203+
# contents note: from head/note[@type='contents-note']
204+
contents_note = first_text(root, ".//tei:head/tei:note[@type='contents-note']")
191205

192206
# classification: collect descs under listRelation or relation descs (e.g., "Old Testament")
193207
classification = text_list(root, ".//tei:listRelation//tei:relation/tei:desc | .//tei:listRelation//tei:desc | .//tei:listRelation//tei:relation/tei:desc")
@@ -246,6 +260,10 @@ def extract_json(tree, part_node=None):
246260
if authorsUri: out["authorUri"] = authorsUri
247261
if incipits: out["incipit"] = incipits
248262
if explicits: out["explicit"] = explicits
263+
if form: out["form"] = form
264+
if extent: out["extent"] = extent
265+
if wright_num: out["wrightNum"] = wright_num
266+
if contents_note: out["contentsNote"] = contents_note
249267

250268
# Deduplicate all list values
251269
for key, value in out.items():

0 commit comments

Comments
 (0)