Skip to content

Generate docs on install, nicer URLs and some caching #107

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

Open
wants to merge 11 commits 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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.exist-db</groupId>
<artifactId>exist-apps-parent</artifactId>
<version>1.12.0</version>
<version>2.0.0</version>
<relativePath />
</parent>

Expand Down
18 changes: 8 additions & 10 deletions src/main/frontend/sass/_doc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ select[name='module'] {
.module .module-head {
background-color: var(--lightgrey);
border-radius: .25rem;
padding-block-end: 1rem;
}

.module .module-head-inner {
Expand All @@ -39,17 +40,16 @@ select[name='module'] {

.module-info-icon {
display: block;
text-align: center;
text-align: right;
margin-top: 1em;
}

.module-info-icon .glyphicon-info-sign {
font-size: 3rem;
font-size: 2.5rem;
}

.module-head p {
font-size: 1.33em;
line-height: 1.5em;
.module-description {
margin-inline-end: 1rem;
}

.module-head td {
Expand All @@ -62,17 +62,15 @@ select[name='module'] {
}

.module-head h3 {
margin-block-start: 1rem;
margin-block-start: 1.25rem;
}

.module-head h4 {
word-wrap: break-word;
}

.function-head h4 {
font-size: 1.25em;
margin-block-end: .8rem;
margin-inline-start: 1rem;
.function-head {
margin-block-start: 2rem;
}

.module .extended {
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/sass/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#main {
margin-block-start: 1.75rem;
min-height: 40vh;
min-height: calc(100vh - 18.5rem);
}

.navbar-dark {
Expand Down
41 changes: 0 additions & 41 deletions src/main/xar-resources/browse.html

This file was deleted.

5 changes: 4 additions & 1 deletion src/main/xar-resources/collection.xconf
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index xmlns:xqdoc="http://www.xqdoc.org/1.0">
<fulltext default="none" attributes="false"/>
<range>
<create qname="xqdoc:uri" />
<create qname="xqdoc:location" />
</range>
<ngram qname="xqdoc:name"/>
<ngram qname="xqdoc:signature"/>
<ngram qname="xqdoc:description"/>
Expand Down
70 changes: 70 additions & 0 deletions src/main/xar-resources/controller.xq
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
xquery version "3.1";

import module namespace login="http://exist-db.org/xquery/login" at "resource:org/exist/xquery/modules/persistentlogin/login.xql";

declare namespace json="http://www.json.org";

declare variable $exist:prefix external;
declare variable $exist:controller external;
declare variable $exist:path external;
declare variable $exist:resource external;

declare variable $local:method := lower-case(request:get-method());
declare variable $local:is-get := $local:method eq 'get';
declare variable $local:user := login:set-user("org.exist.login", (), false());

declare function local:render-view($view as xs:string) {
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="templates/pages/{$view}.html"/>
<view>
<forward url="{$exist:controller}/modules/view.xq">
<set-attribute name="$exist:prefix" value="{$exist:prefix}"/>
<set-attribute name="$exist:controller" value="{$exist:controller}"/>
</forward>
</view>
</dispatch>
};

if ($exist:path eq '') then (
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<redirect url="{concat(request:get-uri(), '/')}"/>
</dispatch>
) else if ($local:is-get and $exist:path eq "/") then (
local:render-view('index')
) else if ($local:is-get and $exist:path eq "/view") then (
local:render-view('view')
) else if ($local:is-get and $exist:path eq "/browse") then (
local:render-view('browse')
) else if ($local:method eq 'post' and $exist:path eq "/query") then (
local:render-view('query')
) else if ($local:is-get and $exist:path eq "/login") then (
try {
util:declare-option("exist:serialize", "method=json"),
<status>
<user>{request:get-attribute("org.exist.login.user")}</user>
<isAdmin json:literal="true">{ sm:is-dba(request:get-attribute("org.exist.login.user")) }</isAdmin>
</status>
} catch * {
response:set-status-code(401),
<status>{$err:description}</status>
}
) else if ($local:is-get and matches($exist:path, ".+\.md$")) then (
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="{$exist:controller}{$exist:path}">
<set-header name="Cache-Control" value="max-age=73600; must-revalidate;"/>
</forward>
</dispatch>
) else if ($local:is-get and matches($exist:path, "/resources/(css|fonts|images|scripts|svg|css)/.+")) then (
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="{$exist:controller}{$exist:path}">
<set-header name="Cache-Control" value="max-age=73600; must-revalidate;"/>
</forward>
</dispatch>
) else if ($local:is-get and $exist:path = "/regenerate") then (
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="{$exist:controller}/modules/regenerate.xq" />
</dispatch>
) else (
response:set-status-code(404),
<data>Not Found</data>
)
59 changes: 0 additions & 59 deletions src/main/xar-resources/controller.xql

This file was deleted.

6 changes: 0 additions & 6 deletions src/main/xar-resources/error-page.html

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/xar-resources/finish.xq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import module namespace generate = "http://exist-db.org/apps/fundocs/generate" at "modules/generate.xqm";

generate:fundocs(),
util:log("info", "Finished generating function documentation for fundocs")
56 changes: 0 additions & 56 deletions src/main/xar-resources/index.html

This file was deleted.

Loading