Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt community XQuery file extension convention #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion content/generate-pmc.xql → content/generate-pmc.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ declare function pmc:generate-pm-config($odds as xs:string*, $default-odd as xs:
for $mode in $modes
let $prefix := if ($mode = "print") then "fo" else $mode
return
``[import module namespace pm-`{$odd}`-`{$mode}`="http://www.tei-c.org/pm/models/`{$odd}`/`{$prefix}`/module" at "../transform/`{$odd}`-`{$mode}`-module.xql";]``
``[import module namespace pm-`{$odd}`-`{$mode}`="http://www.tei-c.org/pm/models/`{$odd}`/`{$prefix}`/module" at "../transform/`{$odd}`-`{$mode}`-module.xqm";]``
})
let $vars :=
for $mode in ("web", "print", "latex", "epub", "tei")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions content/util.xql → content/util.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ declare function pmu:process($oddPath as xs:string, $xml as node()*, $output-roo
let $oddFile := replace($oddPath, "^.*?([^/]+)$", "$1")
let $name := replace($oddPath, "^.*?([^/\.]+)\.[^\.]+$", "$1")
let $collection := replace($oddPath, "^(.*?)/[^/]+$", "$1")
let $uri := $output-root || "/" || $name || "-" || $mode || "-main.xql"
let $uri := $output-root || "/" || $name || "-" || $mode || "-main.xq"
(: let $main :=
if (pmu:requires-update($oddSource, $output-root, $name || "-" || $mode || "-main.xql")) then
if (pmu:requires-update($oddSource, $output-root, $name || "-" || $mode || "-main.xq")) then
let $log := util:log('WARN', "Update required: " || $name)
let $odd := odd:get-compiled($collection, $oddFile)
let $config := pmu:process-odd($odd, $output-root, $mode, $relPath, $config)
Expand All @@ -121,7 +121,7 @@ declare function pmu:process-odd($odd as document-node(), $output-root as xs:str
};

(:~
: Compile the given ODD into an XQuery module.
: Compile the given ODD into an XQuery library module.
:
: @param $odd the ODD document to compile
: @param $output-root collection URI into which to write generated files
Expand Down Expand Up @@ -149,7 +149,7 @@ declare function pmu:process-odd($odd as document-node(), $output-root as xs:str
let $error := util:compile-query($generated?code, $output-root)
return
if ($error/error) then
let $xquery := xmldb:store($output-root, $name || "-" || $mode || ".invalid.xql", $generated?code, "application/xquery")
let $xquery := xmldb:store($output-root, $name || "-" || $mode || ".invalid.xqm", $generated?code, "application/xquery")
return
map {
"id": $name,
Expand All @@ -159,7 +159,7 @@ declare function pmu:process-odd($odd as document-node(), $output-root as xs:str
"code": $generated?code
}
else
let $xquery := xmldb:store($output-root, $name || "-" || $mode || ".xql", $generated?code, "application/xquery")
let $xquery := xmldb:store($output-root, $name || "-" || $mode || ".xqm", $generated?code, "application/xquery")
let $style := pmu:extract-styles($odd, $name, $oddPath, $output-root)
let $main := pmu:generate-main($name, $generated?uri, $xquery, $ext-modules, $output-root, $mode, $relPath, $style, $config)
let $module := pmu:generate-module($name, $generated?uri, $xquery, $ext-modules, $output-root, $mode, $relPath, $style, $config)
Expand Down Expand Up @@ -194,7 +194,7 @@ declare function pmu:generate-module($name as xs:string, $uri as xs:string,
" return m:transform($options, $xml)
" ||
"};"
return
xmldb:store($output-root, $name || "-" || $mode || "-module.xql", $mainCode, "application/xquery")
xmldb:store($output-root, $name || "-" || $mode || "-module.xqm", $mainCode, "application/xquery")
};

declare function pmu:generate-main($name as xs:string, $uri as xs:string, $xqueryFile as xs:string,
Expand All @@ -214,7 +214,7 @@ declare function pmu:generate-main($name as xs:string, $uri as xs:string, $xquer
'}
' ||
"return m:transform($options, $xml)"
let $stored :=
xmldb:store($output-root, $name || "-" || $mode || "-main.xql", $mainCode, "application/xquery")
xmldb:store($output-root, $name || "-" || $mode || "-main.xq", $mainCode, "application/xquery")
let $chmod := sm:chmod($stored, "rwxrwxr-x")
return
$stored
Expand Down
File renamed without changes.
28 changes: 14 additions & 14 deletions expath-pkg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,58 @@
<dependency processor="http://exist-db.org" semver-min="3.6.0" />
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/functions</namespace>
<file>html-functions.xql</file>
<file>html-functions.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/functions/fo</namespace>
<file>fo-functions.xql</file>
<file>fo-functions.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/functions/latex</namespace>
<file>latex-functions.xql</file>
<file>latex-functions.xqm</file>
</xquery>
<xquery>
<namespace>http://existsolutions.com/xquery/functions/tei</namespace>
<file>tei-functions.xql</file>
<file>tei-functions.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/functions/epub</namespace>
<file>ext-epub.xql</file>
<file>ext-epub.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/model</namespace>
<file>model.xql</file>
<file>model.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/util</namespace>
<file>util.xql</file>
<file>util.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/xqgen</namespace>
<file>xqgen.xql</file>
<file>xqgen.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/css</namespace>
<file>css.xql</file>
<file>css.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/odd2odd</namespace>
<file>odd2odd.xql</file>
<file>odd2odd.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/counters</namespace>
<file>counters.xql</file>
<file>counters.xqm</file>
</xquery>
<xquery>
<namespace>http://existsolutions.com/teipublisher/docx</namespace>
<file>docx.xql</file>
<file>docx.xqm</file>
</xquery>
<xquery>
<namespace>https://w3id.org/dts/api#</namespace>
<file>dts-api.xql</file>
<file>dts-api.xqm</file>
</xquery>
<xquery>
<namespace>http://www.tei-c.org/tei-simple/xquery/config</namespace>
<file>generate-pmc.xql</file>
<file>generate-pmc.xqm</file>
</xquery>
</package>