now index and display subentries
This commit is contained in:
parent
a8c0ea875c
commit
4ef96c50ab
4 changed files with 57 additions and 45 deletions
|
@ -131,41 +131,16 @@ $( document ).ready(function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Plotly.newPlot(map, [$(this).data('map')], layout);
|
Plotly.newPlot(map, [$(this).data('map')], layout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// var data = [{
|
|
||||||
// type: 'scattergeo',
|
|
||||||
// mode: 'markers+text',
|
|
||||||
// text: [
|
|
||||||
// 'Montreal', 'Toronto', 'Vancouver', 'Calgary', 'Edmonton',
|
|
||||||
// 'Ottawa', 'Halifax', 'Victoria', 'Winnepeg', 'Regina'
|
|
||||||
// ],
|
|
||||||
// hovertext: 'HIMEM.SYS<br>EGAVGA.BGI',
|
|
||||||
// hoverinfo: 'text',
|
|
||||||
// lon: [
|
|
||||||
// -73.57, -79.24, -123.06, -114.1, -113.28,
|
|
||||||
// -75.43, -63.57, -123.21, -97.13, -104.6
|
|
||||||
// ],
|
|
||||||
// lat: [
|
|
||||||
// 45.5, 43.4, 49.13, 51.1, 53.34, 45.24,
|
|
||||||
// 44.64, 48.25, 49.89, 50.45
|
|
||||||
// ],
|
|
||||||
// marker: {
|
|
||||||
// size: 7,
|
|
||||||
// // color: [
|
|
||||||
// // '#bebada', '#fdb462', '#fb8072', '#d9d9d9', '#bc80bd',
|
|
||||||
// // '#b3de69', '#8dd3c7', '#80b1d3', '#fccde5', '#ffffb3'
|
|
||||||
// // ],
|
|
||||||
// line: {
|
|
||||||
// width: 1
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// name: 'Canadian cities',
|
|
||||||
// textposition: [
|
|
||||||
// 'top right', 'top left', 'top center', 'bottom right', 'top right',
|
|
||||||
// 'top left', 'bottom right', 'bottom left', 'top right', 'top right'
|
|
||||||
// ],
|
|
||||||
// }];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Event handler to show subentries
|
||||||
|
$('#show-re').on("change", function () {
|
||||||
|
if($(this).prop('checked')) {
|
||||||
|
console.log('haha')
|
||||||
|
$('li.abv-menu-re').removeAttr('hidden');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('li.abv-menu-re').prop('hidden',true);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,6 +15,7 @@ as xs:string {
|
||||||
=> replace('\)','')
|
=> replace('\)','')
|
||||||
=> replace('́','') (: combining acute :)
|
=> replace('́','') (: combining acute :)
|
||||||
=> replace('\*','')
|
=> replace('\*','')
|
||||||
|
=> replace('ᵆ','')
|
||||||
|
|
||||||
=> replace('a','/')
|
=> replace('a','/')
|
||||||
=> replace('A', '/')
|
=> replace('A', '/')
|
||||||
|
@ -44,6 +45,7 @@ as xs:string {
|
||||||
|
|
||||||
=> replace('ʒ', '6')
|
=> replace('ʒ', '6')
|
||||||
=> replace('Ʒ', '6')
|
=> replace('Ʒ', '6')
|
||||||
|
=> replace('ǯ', '6')
|
||||||
|
|
||||||
=> replace('e', '7')
|
=> replace('e', '7')
|
||||||
=> replace('E', '7')
|
=> replace('E', '7')
|
||||||
|
@ -67,6 +69,8 @@ as xs:string {
|
||||||
|
|
||||||
=> replace('ǧ', 'A')
|
=> replace('ǧ', 'A')
|
||||||
=> replace('Ǧ', 'A')
|
=> replace('Ǧ', 'A')
|
||||||
|
=> replace('h', 'A')
|
||||||
|
=> replace('H', 'A')
|
||||||
|
|
||||||
=> replace('i', 'B')
|
=> replace('i', 'B')
|
||||||
=> replace('I', 'B')
|
=> replace('I', 'B')
|
||||||
|
@ -166,6 +170,8 @@ as xs:string {
|
||||||
|
|
||||||
=> replace('z', 'X')
|
=> replace('z', 'X')
|
||||||
=> replace('Z', 'X')
|
=> replace('Z', 'X')
|
||||||
|
=> replace('ž', 'X')
|
||||||
|
=> replace('Ž', 'X')
|
||||||
};
|
};
|
||||||
|
|
||||||
declare function abv-m:sort-collection($docs as document-node()+) {
|
declare function abv-m:sort-collection($docs as document-node()+) {
|
||||||
|
|
|
@ -2,11 +2,13 @@ declare default element namespace "http://www.tei-c.org/ns/1.0";
|
||||||
declare namespace tei = "http://www.tei-c.org/ns/1.0";
|
declare namespace tei = "http://www.tei-c.org/ns/1.0";
|
||||||
declare namespace abv = "http://ossetic-studies.org/ns/abaevdict";
|
declare namespace abv = "http://ossetic-studies.org/ns/abaevdict";
|
||||||
|
|
||||||
|
import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at './abv-mod.xqm';
|
||||||
|
|
||||||
declare function local:genLookupEntry($doc as document-node())
|
declare function local:genLookupEntry($doc as document-node())
|
||||||
as element()?
|
as element()?
|
||||||
{
|
{
|
||||||
let $node := $doc/tei:TEI/tei:text/tei:body/tei:entry
|
let $node := $doc/tei:TEI/tei:text/tei:body/tei:entry
|
||||||
let $phon := $node/tei:form[1]/tei:orth[1]/text()[1]
|
let $phon := normalize-space(data($node/tei:form[1]/tei:orth[1]))
|
||||||
|
|
||||||
return element entry {
|
return element entry {
|
||||||
attribute xml:id { $node/@xml:id },
|
attribute xml:id { $node/@xml:id },
|
||||||
|
@ -16,9 +18,21 @@ as element()?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let $entries := for $doc in collection('abaevdict')
|
||||||
|
return local:genLookupEntry($doc)
|
||||||
|
|
||||||
|
let $subentries := for $doc in collection('abaevdict')
|
||||||
|
for $re in $doc//re
|
||||||
|
let $etext := normalize-space(data($re/form[1]/orth[1]))
|
||||||
|
where $etext != '' and not($etext = $entries/text())
|
||||||
|
and not(starts-with($etext,','))
|
||||||
|
and string-to-codepoints($etext)[1] != string-to-codepoints(' ')
|
||||||
|
return <re corresp="{$doc/tei:TEI/tei:text/tei:body/tei:entry/@xml:id}">{$etext}</re>
|
||||||
|
|
||||||
let $tbl := <table>
|
let $tbl := <table>
|
||||||
{for $doc in collection('abaevdict')
|
{for $e in ($entries,$subentries)
|
||||||
return local:genLookupEntry($doc)}
|
order by abv-m:sortKey($e/text())
|
||||||
|
return $e}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
return db:put('abaevdict_index', $tbl, 'lookup.xml')
|
return db:put('abaevdict_index', $tbl, 'lookup.xml')
|
|
@ -14,8 +14,12 @@ declare variable $page:items as xs:integer := 20;
|
||||||
(: These variables are declared in module scope because they are needed in
|
(: These variables are declared in module scope because they are needed in
|
||||||
different places, but they are still dynamically evaluated :)
|
different places, but they are still dynamically evaluated :)
|
||||||
declare variable $page:lookup := doc('abaevdict_index/lookup.xml')/tei:table/tei:entry;
|
declare variable $page:lookup := doc('abaevdict_index/lookup.xml')/tei:table/tei:entry;
|
||||||
|
declare variable $page:lookup-all := doc('abaevdict_index/lookup.xml')/tei:table/*;
|
||||||
|
|
||||||
declare variable $page:total := ceiling(count($page:lookup) div $page:items);
|
declare variable $page:total := ceiling(count($page:lookup) div $page:items);
|
||||||
declare variable $page:sorted := abv-m:sort-nodes($page:lookup);
|
(: This is still called sorted, because I haven't changed the code.
|
||||||
|
But it's now equal to lookup, because the lookup itself is now sorted. :)
|
||||||
|
declare variable $page:sorted := $page:lookup;
|
||||||
|
|
||||||
(: =============================================================== :)
|
(: =============================================================== :)
|
||||||
(: ======================= COMMON STUFF ========================== :)
|
(: ======================= COMMON STUFF ========================== :)
|
||||||
|
@ -331,15 +335,28 @@ declare %rest:path("{$lang}/dict")
|
||||||
{html:doc('../static/chevron-left.svg')}
|
{html:doc('../static/chevron-left.svg')}
|
||||||
</button>
|
</button>
|
||||||
<aside id="leftbar">
|
<aside id="leftbar">
|
||||||
<input type="text" id="filter-entries" placeholder="Quick filter…"/>
|
<fieldset>
|
||||||
|
<input type="text" id="filter-entries"
|
||||||
|
placeholder="{if ($lang = 'ru') then 'Быстрый фильтр' else 'Quick filter…'}"/>
|
||||||
|
<label>
|
||||||
|
<input id="show-re" type="checkbox" role="switch"></input>
|
||||||
|
{if ($lang = 'ru') then 'Производные' else 'Show subentries'}
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
<nav id="entrylist">
|
<nav id="entrylist">
|
||||||
<ul>
|
<ul>
|
||||||
{for $doc in $page:sorted
|
{for $doc in $page:lookup-all
|
||||||
return <li id="link_{$doc/@xml:id}">
|
let $id := if ($doc/name() = 'entry') then $doc/@xml:id
|
||||||
<a href="./dict/{$doc/@xml:id}">
|
else $doc/@corresp
|
||||||
|
return element li {
|
||||||
|
if ($doc/name() = 're') then
|
||||||
|
(attribute hidden {'true'},
|
||||||
|
attribute class {'abv-menu-re'}) else (),
|
||||||
|
attribute id {`link_{$id}`},
|
||||||
|
<a href="./dict/{$id}">
|
||||||
{$doc/text()}
|
{$doc/text()}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
}
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
Loading…
Add table
Reference in a new issue