Skip to content

Commit

Permalink
0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSteffanick committed Feb 18, 2019
1 parent 47fb60b commit e8ba373
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 47 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

## [0.2.3] - 2019-02-18
### Added
* `bootstrap:navbar-search()` @param `$parameter` ([bootstrap.xquery])

### Fixed
* `m:html5-body` empty sequence bug ([model.xquery])
* `m:html5-head` empty sequence bug ([model.xquery])
* refactored `m:html5-refine()` ([model.xquery])

## [0.2.2] - 2019-02-15
### Added
* `$bootstrap:template` ([bootstrap.xquery])
Expand Down Expand Up @@ -90,7 +99,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
* [LISENCE]
* [README.md]

[Unreleased]: https://github.com/AdamSteffanick/mvc-xquery/compare/v0.2.2...HEAD
[Unreleased]: https://github.com/AdamSteffanick/mvc-xquery/compare/v0.2.3...HEAD
[0.2.3]: https://github.com/AdamSteffanick/mvc-xquery/compare/v0.2.2...v0.2.3
[0.2.2]: https://github.com/AdamSteffanick/mvc-xquery/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/AdamSteffanick/mvc-xquery/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/AdamSteffanick/mvc-xquery/compare/v0.1.1...v0.2.0
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Copyright (C) 2018 [Adam Steffanick](https://www.steffanick.com/adam/)
* Run the [BaseX HTTP Server](http://docs.basex.org/wiki/Startup#HTTP_Server)
* Navigate to http://localhost:8984 in your browser

### m:html5() default output:
### Default output
#### m:html5()
```
<!DOCTYPE html>
<html lang="en">
Expand All @@ -30,7 +31,7 @@ Copyright (C) 2018 [Adam Steffanick](https://www.steffanick.com/adam/)
</html>
```

### m:html5($bootstrap:template) default output:
#### m:html5($bootstrap:template)
```
<html lang="en">
<head>
Expand Down Expand Up @@ -76,7 +77,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

[CHANGELOG]: ./CHANGELOG.md
[version-badge]: https://img.shields.io/badge/mvc--xquery-v0.2.2-0038e2.svg?style=flat-square
[version-badge]: https://img.shields.io/badge/mvc--xquery-v0.2.3-0038e2.svg?style=flat-square
[LICENSE]: ./LICENSE
[license-badge]: https://img.shields.io/badge/license-GPL-0038e2.svg?style=flat-square

Expand Down
5 changes: 2 additions & 3 deletions controller.xquery
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ xquery version "3.1" encoding "UTF-8";
:
: @author Adam Steffanick
: @see https://www.steffanick.com/adam/
: @version v0.2.2
: @version v0.2.3
: @see https://github.com/AdamSteffanick/mvc-xquery
: February 15, 2019
: February 18, 2019
: @since v0.0.2
:
: This program is free software: you can redistribute it and/or modify
Expand All @@ -37,7 +37,6 @@ import module namespace v = "view" at "view.xquery";

(: optional, included function library modules :)
import module namespace bootstrap = "bootstrap" at "modules/bootstrap.xquery";
import module namespace vuwr = "vuwr" at "modules/vuwr.xquery";

(:~
: A function to return an HTML5 home page to the user.
Expand Down
65 changes: 39 additions & 26 deletions model.xquery
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ xquery version "3.1" encoding "UTF-8";
:
: @author Adam Steffanick
: @see https://www.steffanick.com/adam/
: @version v0.2.2
: @version v0.2.3
: @see https://github.com/AdamSteffanick/mvc-xquery
: February 15, 2019
: February 18, 2019
: @since v0.0.2
:
: This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -302,7 +302,7 @@ declare %private function m:html5-filter(
:
: @author Adam Steffanick
: @see https://www.steffanick.com/adam/
: @version v1.0.2
: @version v1.0.3
: @since v0.1.0
:
: @param (optional) $parameter is a sequence of zero or one map items
Expand All @@ -326,17 +326,25 @@ declare %private function m:html5-head(
) as element(head)
{
let $head := (
element head {
m:html5-head-meta(map:get($parameter, "meta")),
m:html5-base(map:get($parameter, "base")),
m:html5-title(map:get($parameter, "title")),
m:html5-link(map:get($parameter, "link")),
m:html5-style(map:get($parameter, "style")),
m:html5-script(map:get($parameter, "script")),
m:html5-noscript(map:get($parameter, "noscript")),
m:html5-meta(map:get($parameter, "metadata")),
m:html5-template(map:get($parameter, "template"))
}
if (
$parameter => fn:empty()
)
then (
m:html5-head()
)
else (
element head {
m:html5-head-meta(map:get($parameter, "meta")),
m:html5-base(map:get($parameter, "base")),
m:html5-title(map:get($parameter, "title")),
m:html5-link(map:get($parameter, "link")),
m:html5-style(map:get($parameter, "style")),
m:html5-script(map:get($parameter, "script")),
m:html5-noscript(map:get($parameter, "noscript")),
m:html5-meta(map:get($parameter, "metadata")),
m:html5-template(map:get($parameter, "template"))
}
)
)
return (
$head
Expand All @@ -348,7 +356,7 @@ declare %private function m:html5-head(
:
: @author Adam Steffanick
: @see https://www.steffanick.com/adam/
: @version v2.0.1
: @version v2.0.2
: @since v0.1.0
:
: @param (optional) $parameter is a sequence of zero or one map items
Expand All @@ -365,18 +373,26 @@ declare %private function m:html5-body(
$parameter as map(*)?
) as element(body)
{
element body {
m:html5-filter(map:get($parameter, "content")),
m:html5-script(map:get($parameter, "script"))
}
if (
$parameter => fn:empty()
)
then (
m:html5-body()
)
else (
element body {
m:html5-filter(map:get($parameter, "content")),
m:html5-script(map:get($parameter, "script"))
}
)
};

(:~
: A function to refine the m:html5() parameter.
:
: @author Adam Steffanick
: @see https://www.steffanick.com/adam/
: @version v1.0.0
: @version v1.0.1
: @since v0.2.2
:
: @param $parameter is a sequence of one or more map items
Expand All @@ -388,10 +404,8 @@ declare %private function m:html5-refine(
{
let $refined-input := (
let $unrefined-input := (
(
$parameter
=> map:merge(map {"duplicates" : "combine"})
)
$parameter
=> map:merge(map {"duplicates" : "combine"})
)
let $merged-input := (
let $simplex-maps := (
Expand Down Expand Up @@ -431,10 +445,9 @@ declare %private function m:html5-refine(
else (
map:get($unrefined-input, $key)
)

)
}
)
)
)
return (
$simplex-maps,
Expand Down
93 changes: 81 additions & 12 deletions modules/bootstrap.xquery
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ xquery version "3.1" encoding "UTF-8";
:
: @author Adam Steffanick
: @see https://www.steffanick.com/adam/
: @version v0.2.2
: @version v0.2.3
: @see https://github.com/AdamSteffanick/mvc-xquery
: February 15, 2019
: February 18, 2019
: @since v0.2.0
:
: This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -72,7 +72,7 @@ declare %public function bootstrap:meta(
attribute content {
"width=device-width, initial-scale=1, shrink-to-fit=no"
}
}
}
};

(:~
Expand Down Expand Up @@ -101,7 +101,7 @@ declare %public function bootstrap:stylesheet(
attribute crossorigin {
"anonymous"
}
}
}
};

(:~
Expand Down Expand Up @@ -243,7 +243,7 @@ declare %public function bootstrap:navbar-ul(
},
$item/name/text()
}
}
}
)
else (
element li {
Expand Down Expand Up @@ -321,17 +321,18 @@ declare %public function bootstrap:navbar-ul(
)
)
}
)
)
};

(:~
: A function to return a Bootstrap navbar component search form.
:
: @author Adam Steffanick
: @see https://www.steffanick.com/adam/
: @version v1.0.1
: @version v2.0.0
: @since v0.2.0
:
: @param (optional) $parameter is a sequence of zero or one map items
: @return one Bootstrap navbar search form
:)
declare %public function bootstrap:navbar-search(
Expand Down Expand Up @@ -375,6 +376,74 @@ declare %public function bootstrap:navbar-search(
}
}
};
declare %public function bootstrap:navbar-search(
$parameter as map(*)?
) as element(form)
{
let $name := (
if (
map:get($parameter, "name")
=> fn:empty()
)
then (
"q"
)
else (
map:get($parameter, "name")
)
)
let $formaction := (
if (
map:get($parameter, "formaction")
=> fn:empty()
)
then (
"/search/"
)
else (
map:get($parameter, "formaction")
)
)
return (
element form {
attribute class {
"form-inline my-2 my-lg-0"
},
element input {
attribute class {
"form-control mr-sm-2"
},
attribute type {
"search"
},
attribute name {
$name
},
attribute placeholder {
"Search"
},
attribute required {
"required"
},
attribute aria-label {
"Search"
}
},
element button {
attribute class {
"btn btn-outline-light my-2 my-sm-0"
},
attribute type {
"submit"
},
attribute formaction {
$formaction
},
"Search"
}
}
)
};

(:~
: A function to return a Bootstrap navbar component.
Expand Down Expand Up @@ -432,7 +501,7 @@ declare %public function bootstrap:navbar(
},
$parameter
}
}
}
};

(:~
Expand All @@ -455,7 +524,7 @@ declare %public function bootstrap:container(
"container"
},
$parameter
}
}
};

(:~
Expand All @@ -478,7 +547,7 @@ declare %public function bootstrap:card(
"card"
},
$parameter
}
}
};

(:~
Expand Down Expand Up @@ -513,7 +582,7 @@ declare %public function bootstrap:card-layout(
)
},
$cards
}
}
};

(:~
Expand Down Expand Up @@ -560,5 +629,5 @@ declare %public function bootstrap:list-group(
}
}
)
}
}
};
4 changes: 2 additions & 2 deletions view.xquery
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ xquery version "3.1" encoding "UTF-8";
:
: @author Adam Steffanick
: @see https://www.steffanick.com/adam/
: @version v0.2.2
: @version v0.2.3
: @see https://github.com/AdamSteffanick/mvc-xquery
: February 15, 2019
: February 18, 2019
: @since v0.0.2
:
: This program is free software: you can redistribute it and/or modify
Expand Down

0 comments on commit e8ba373

Please sign in to comment.