From aaee1b802579c23aa48bb309d36f57606e52d15b Mon Sep 17 00:00:00 2001 From: Christian Mueller Date: Wed, 1 Oct 2014 16:45:06 +0200 Subject: [PATCH] text size setting can be set by API calls now --- API.md | 3 ++- src/notehub/api.clj | 2 +- test/notehub/test/api.clj | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/API.md b/API.md index 68a8365..2624631 100644 --- a/API.md +++ b/API.md @@ -6,7 +6,7 @@ - **V1.4**: Bugfix: no whitespace elimination from the note text is needed now for the signature compuation. - **V1.3**: New note ID format. -- **V1.2**: Theme & fonts can be specified during the publishing. +- **V1.2**: Theme & font settings can be specified during the publishing. - **V1.1**: fields `publisher` and `title` in the response to the note retrieval. - **V1.0**: initial release. @@ -77,6 +77,7 @@ Parameter | Explanation | Type `password` | Secret token (plain or hashed) | *optional* `version` | Used API version | **required** `theme` | Theme name | *optional* +`text-size` | Text size | *optional* `text-font` | Text font name | *optional* `header-font`| Header font name | *optional* diff --git a/src/notehub/api.clj b/src/notehub/api.clj index 1dc4fd4..752a60b 100644 --- a/src/notehub/api.clj +++ b/src/notehub/api.clj @@ -91,7 +91,7 @@ (when (blank? note) "note is empty")])] (if (empty? errors) (let [[year month day] (map str (get-date)) - params (select-keys params [:text-font :header-font :theme]) + params (select-keys params [:text-size :text-font :header-font :theme]) raw-title (filter #(or (= \- %) (Character/isLetterOrDigit %)) (-> note derive-title trim (sreplace " " "-") lower-case)) max-length (get-setting :max-title-length #(Integer/parseInt %) 80) diff --git a/test/notehub/test/api.clj b/test/notehub/test/api.clj index 0d4648a..f2b6788 100644 --- a/test/notehub/test/api.clj +++ b/test/notehub/test/api.clj @@ -147,6 +147,7 @@ :signature (storage/sign pid psk note) :version "1.4" :theme "dark" + :text-size 1.1 :text-font "Helvetica"}) body (parse-string (:body response)) noteID (body "noteID")] @@ -156,8 +157,9 @@ (last (clojure.string/split ((parse-string (:body response)) "shortURL") #"/"))))) "Location")] (= url ((parse-string (:body response)) "longURL")) - (substring? "theme=dark" url) - (substring? "text-font=Felvetica" url)) + (is (substring? "theme=dark" url)) + (is (substring? "text-size=1.1" url)) + (is (substring? "text-font=Helvetica" url))) (is (do (storage/delete-note noteID) (not (storage/note-exists? noteID)))))))