Added preliminary files

This commit is contained in:
Simon Brooke 2018-06-19 16:20:09 +01:00
parent 2c54418d76
commit 1353a0581c
9 changed files with 129 additions and 5 deletions

24
CHANGELOG.md Normal file
View file

@ -0,0 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [Unreleased]
### Changed
- Add a new arity to `make-widget-async` to provide a different widget shape.
## [0.1.1] - 2018-06-17
### Changed
- Documentation on how to make the widgets.
### Removed
- `make-widget-sync` - we're all async, all the time.
### Fixed
- Fixed widget maker to keep working when daylight savings switches over.
## 0.1.0 - 2018-06-17
### Added
- Files from the new template.
- Widget maker public API - `make-widget-sync`.
[Unreleased]: https://github.com/your-name/adl-support/compare/0.1.1...HEAD
[0.1.1]: https://github.com/your-name/adl-support/compare/0.1.0...0.1.1

View file

@ -1,6 +1,4 @@
MIT License
Copyright (c) 2018 Simon Brooke
Copyright 2018 Simon Brooke <simon@journeyman.cc>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -17,5 +15,5 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

22
LICENSE.md Normal file
View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

13
README.md Normal file
View file

@ -0,0 +1,13 @@
# adl-support
A Clojure library designed to support auto-generated ADL code. This library should normally be included into projects generated by ADL, and consequently is licenced under the MIT license, which is less restrictive than the GNU General Public License which I normally use.
## Usage
FIXME
## License
Copyright © 2018 FIXME
Distributed under the MIT License.

3
doc/intro.md Normal file
View file

@ -0,0 +1,3 @@
# Introduction to adl-support
TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)

7
project.clj Normal file
View file

@ -0,0 +1,7 @@
(defproject adl-support "0.1.0-SNAPSHOT"
:description "A small library of functions called by generated ADL code."
:url "http://example.com/FIXME"
:license {:name "MIT License"
:url "https://opensource.org/licenses/MIT"}
:dependencies [[org.clojure/clojure "1.8.0"]
[selmer "1.10.6"]])

16
src/adl_support/core.clj Normal file
View file

@ -0,0 +1,16 @@
(ns adl-support.core
(:require [clojure.string :refer [split]]))
(defn query-string-to-map
[query-string]
(reduce
merge
(map
#(let [pair (split % #"=")
value (try
(read-string (nth pair 1))
(catch Exception _
(nth pair 1)))]
(hash-map (keyword (first pair) (nth pair 1))))
(split query-string #"\&"))))

34
src/adl_support/tags.clj Normal file
View file

@ -0,0 +1,34 @@
(ns adl-support.tags
(:require selmer.node
[selmer.filter-parser :refer [split-filter-val
safe-filter
compile-filter-body
fix-accessor
get-accessor]]
[selmer.filters :refer [filters]]
[selmer.util :refer :all]
[json-html.core :refer [edn->html]])
(:import [selmer.node INode TextNode FunctionNode]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; adl-support.tags: selmer tags required by ADL selmer views.
;;;;
;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the MIT-style licence provided; see LICENSE.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;;; License for more details.
;;;;
;;;; Copyright (C) 2018 Simon Brooke
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn if-writable-handler [params tag-content render rdr]
"If the current element is writable by the current user, emit the content of
the if clause; else emit the content of the else clause."
(let [{if-tags :ifwritable else-tags :else} (tag-content rdr :ifwritable :else :endifwritable)]
params))

View file

@ -0,0 +1,7 @@
(ns adl-support.core-test
(:require [clojure.test :refer :all]
[adl-support.core :refer :all]))
(deftest a-test
(testing "FIXME, I fail."
(is (= 0 1))))