Skip to content

Commit

Permalink
- [X] Fix description extract - https://github.com/ardumont/org-trell…
Browse files Browse the repository at this point in the history
  • Loading branch information
ardumont committed Feb 3, 2014
1 parent 5f79855 commit b5922fc
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 12 deletions.
3 changes: 2 additions & 1 deletion TODO.org
Original file line number Diff line number Diff line change
Expand Up @@ -839,10 +839,11 @@ CLOSED: [2014-01-23 jeu. 21:11]
- [X] Version
- [X] Release notes

* IN-PROGRESS 0.3.2 [60%]
* IN-PROGRESS 0.3.2 [66%]
- [X] Use standard remapping to override the org-end-of-line routine - https://www.gnu.org/software/emacs/manual/html_node/elisp/Remapping-Commands.html
- [X] Clean some dead code
- [X] Use standard mode map definition for the org-trello bindings
- [X] Fix description extract - https://github.com/ardumont/org-trello/issues/114
- [ ] Version
- [ ] Release notes
* TODO 0.3.3 [%]
Expand Down
60 changes: 54 additions & 6 deletions org-trello-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -1818,15 +1818,15 @@ this is a hell of a ride"))
how are you today
this is a hell of a ride")))

(expectations
(expectations (desc "orgtrello-buffer/extract-description-from-current-position! - standard org-trello properties without blanks before them.")
(expect "hello there"
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES
:PROPERTIES:
:orgtrello-id: 52c945143004d4617c012528
:END:
hello there
"
(orgtrello-buffer/extract-description-from-current-position)))
(orgtrello-buffer/extract-description-from-current-position!)))

(expect "hello there"
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES
Expand All @@ -1837,7 +1837,7 @@ hello there
- [-] LISP family :PROPERTIES: {\"orgtrello-id\":\"52c945140a364c5226007314\"}
- [X] Emacs-Lisp :PROPERTIES: {\"orgtrello-id\":\"52c9451784251e1b260127f8\"}
- [X] Common-Lisp :PROPERTIES: {\"orgtrello-id\":\"52c94518b2c5b28e37012ba4\"}"
(orgtrello-buffer/extract-description-from-current-position)))
(orgtrello-buffer/extract-description-from-current-position!)))

(expect "hello there\n"
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES
Expand All @@ -1850,18 +1850,66 @@ hello there
- [-] LISP family :PROPERTIES: {\"orgtrello-id\":\"52c945140a364c5226007314\"}
- [X] Emacs-Lisp :PROPERTIES: {\"orgtrello-id\":\"52c9451784251e1b260127f8\"}
- [X] Common-Lisp :PROPERTIES: {\"orgtrello-id\":\"52c94518b2c5b28e37012ba4\"}"
(orgtrello-buffer/extract-description-from-current-position)))
(orgtrello-buffer/extract-description-from-current-position!)))

(expect nil
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES" (orgtrello-buffer/extract-description-from-current-position)))
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES" (orgtrello-buffer/extract-description-from-current-position!)))

(expect ""
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES
:PROPERTIES:
:orgtrello-id: 52c945143004d4617c012528
:END:
- [-] LISP family :PROPERTIES: {\"orgtrello-id\":\"52c945140a364c5226007314\"}"
(orgtrello-buffer/extract-description-from-current-position))))
(orgtrello-buffer/extract-description-from-current-position!))))

(expectations (desc "orgtrello-buffer/extract-description-from-current-position! - non standard org-trello properties with blanks before them.")
(expect "hello there"
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES
:PROPERTIES:
:orgtrello-id: 52c945143004d4617c012528
:END:
hello there
"
(orgtrello-buffer/extract-description-from-current-position!)))

(expect "hello there"
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES
:PROPERTIES:
:orgtrello-id: 52c945143004d4617c012528
:END:
hello there
- [-] LISP family :PROPERTIES: {\"orgtrello-id\":\"52c945140a364c5226007314\"}
- [X] Emacs-Lisp :PROPERTIES: {\"orgtrello-id\":\"52c9451784251e1b260127f8\"}
- [X] Common-Lisp :PROPERTIES: {\"orgtrello-id\":\"52c94518b2c5b28e37012ba4\"}"
(orgtrello-buffer/extract-description-from-current-position!)))

(expect "hello there\n"
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES
:PROPERTIES:
:orgtrello-id: 52c945143004d4617c012528
:END:
hello there
- [-] LISP family :PROPERTIES: {\"orgtrello-id\":\"52c945140a364c5226007314\"}
- [X] Emacs-Lisp :PROPERTIES: {\"orgtrello-id\":\"52c9451784251e1b260127f8\"}
- [X] Common-Lisp :PROPERTIES: {\"orgtrello-id\":\"52c94518b2c5b28e37012ba4\"}"
(orgtrello-buffer/extract-description-from-current-position!)))
(expect ""
(orgtrello-tests/with-temp-buffer "* TODO Joy of FUN(ctional) LANGUAGES
:PROPERTIES:
:orgtrello-id: 52c945143004d4617c012528
:END:
- [-] LISP family :PROPERTIES: {\"orgtrello-id\":\"52c945140a364c5226007314\"}"
(orgtrello-buffer/extract-description-from-current-position!))))

(expectations (desc "orgtrello-buffer/filter-out-properties - removing lines starting with org-trello metadata properties.")
(expect "no filter happens here." (orgtrello-buffer/filter-out-properties "no filter happens here."))
(expect "no filter happens here." (orgtrello-buffer/filter-out-properties " no filter happens here."))
(expect "" (orgtrello-buffer/filter-out-properties ":PROPERTIES: filter happens and blank is left."))
(expect "" (orgtrello-buffer/filter-out-properties " :PROPERTIES: filter still happens and blank is left."))
(expect "multiple lines\n" (orgtrello-buffer/filter-out-properties " multiple lines\n :PROPERTIES: filter still happens and blank is left.")))

(expectations
(expect "complete" (orgtrello-controller/compute-state *DONE*))
Expand Down
4 changes: 2 additions & 2 deletions org-trello.el
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ To change such level, add this to your init.el file: (setq *orgtrello-log/level*
(cons od/--point)
(cons (buffer-name))
(cons (orgtrello-controller/--user-ids-assigned-to-current-card))
(cons (orgtrello-buffer/extract-description-from-current-position))
(cons (orgtrello-buffer/extract-description-from-current-position!))
orgtrello-data/--convert-to-orgtrello-metadata)))

(defun orgtrello-action/org-up-parent () "A function to get back to the current entry's parent"
Expand Down Expand Up @@ -1594,7 +1594,7 @@ refresh(\"/proxy/admin/entities/current/\", '#current-action');
(orgtrello-cbx/--goto-next-checkbox)
(1- (point))))

(defun orgtrello-buffer/extract-description-from-current-position () "Given the current position, extract the text content of current card."
(defun orgtrello-buffer/extract-description-from-current-position! () "Given the current position, extract the text content of current card."
(let ((start (orgtrello-buffer/--card-data-start-point))
(end (orgtrello-buffer/--first-checkbox-point)))
(when (< start end)
Expand Down
4 changes: 2 additions & 2 deletions src/buffer.el
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(orgtrello-cbx/--goto-next-checkbox)
(1- (point))))

(defun orgtrello-buffer/extract-description-from-current-position () "Given the current position, extract the text content of current card."
(defun orgtrello-buffer/extract-description-from-current-position! () "Given the current position, extract the text content of current card."
(let ((start (orgtrello-buffer/--card-data-start-point))
(end (orgtrello-buffer/--first-checkbox-point)))
(when (< start end)
Expand All @@ -22,7 +22,7 @@

(defun orgtrello-buffer/filter-out-properties (text-content) "Given a string, remove any org properties if any"
(->> text-content
(replace-regexp-in-string "^:.*" "")
(replace-regexp-in-string "^[ ]*:.*" "")
(s-trim-left)))


2 changes: 1 addition & 1 deletion src/data.el
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
(cons od/--point)
(cons (buffer-name))
(cons (orgtrello-controller/--user-ids-assigned-to-current-card))
(cons (orgtrello-buffer/extract-description-from-current-position))
(cons (orgtrello-buffer/extract-description-from-current-position!))
orgtrello-data/--convert-to-orgtrello-metadata)))

(defun orgtrello-action/org-up-parent () "A function to get back to the current entry's parent"
Expand Down

0 comments on commit b5922fc

Please sign in to comment.