Skip to content

Commit

Permalink
Order ODDs alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangmm committed Feb 2, 2024
1 parent 7d57425 commit d14ea25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion modules/config.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ declare variable $config:default-odd := "teipublisher.odd";
: make sure to run modules/generate-pm-config.xql to update the main configuration
: module for transformations (modules/pm-config.xql).
:)
declare variable $config:odd-available := xmldb:get-child-resources($config:odd-root)[ends-with(., ".odd")];
declare variable $config:odd-available :=
xmldb:get-child-resources($config:odd-root)[ends-with(., ".odd")][. != "teipublisher_odds.odd"];

(:~
: List of ODD files which are used internally only, i.e. not for displaying information
Expand Down
4 changes: 2 additions & 2 deletions modules/lib/api/odd.xql
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ declare function oapi:recompile($request as map(*)) {

declare function oapi:list-odds($request as map(*)) {
array {
for $doc in xmldb:get-child-resources(xs:anyURI($config:odd-root))
for $doc in distinct-values(($config:odd-available, $config:odd-internal))
let $resource := $config:odd-root || "/" || $doc
where ends-with($resource, ".odd")
let $name := replace($resource, "^.*/([^/\.]+)\..*$", "$1")
let $displayName := (
doc($resource)/TEI/teiHeader/fileDesc/titleStmt/title[@type = "short"]/string(),
doc($resource)/TEI/teiHeader/fileDesc/titleStmt/title/text(),
$name
)[1]
let $description := doc($resource)/TEI/teiHeader/fileDesc/titleStmt/title/desc/string()
order by $displayName
return
map {
"name": $name,
Expand Down

0 comments on commit d14ea25

Please sign in to comment.