Skip to content

Commit

Permalink
update org-mode export, now comments not removed from ticket
Browse files Browse the repository at this point in the history
and replaced to a regular words
  • Loading branch information
KirillTemnov committed Mar 2, 2011
1 parent 5140ac1 commit cdac283
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .strack
Expand Up @@ -4,8 +4,8 @@
"0c520fa874e0214d22e41463493a64ce": {"created":"2011-02-25T15:07:51.549Z","modified":"2011-02-25T15:25:32.825Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo +archive for tickets","id":"0c520fa874e0214d22e41463493a64ce","comments":[],"log":[],"state":"todo"},
"b90ea6db72184a5da1b5ba687ed1dfdc": {"created":"2011-02-25T15:08:11.777Z","modified":"2011-02-25T15:16:11.970Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@fixed Not print Tickets 0/0 if tracker is empty +log","id":"b90ea6db72184a5da1b5ba687ed1dfdc","comments":[],"log":[],"state":"fixed"},
"a2ed65e5c06cd611d8077b92982243ac": {"created":"2011-02-25T15:08:30.760Z","modified":"2011-02-25T17:01:39.254Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done Create Readme.md","id":"a2ed65e5c06cd611d8077b92982243ac","comments":[],"log":[],"state":"done"},
"220dd79504b4383bd6d10e28835c35fc": {"created":"2011-02-25T15:08:49.346Z","modified":"2011-02-28T18:42:30.641Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo +export to html\u001b:\n","id":"220dd79504b4383bd6d10e28835c35fc","comments":[],"log":[],"state":"todo"},
"d9b76b4839b0662f7a242ddef9c1bbec": {"created":"2011-02-25T15:08:52.547Z","modified":"2011-03-02T10:16:47.698Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done +export to org","id":"d9b76b4839b0662f7a242ddef9c1bbec","comments":[],"log":[],"state":"todo"},
"220dd79504b4383bd6d10e28835c35fc": {"created":"2011-02-25T15:08:49.346Z","modified":"2011-02-28T18:42:30.641Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo +export to html\n","id":"220dd79504b4383bd6d10e28835c35fc","comments":[],"log":[],"state":"todo"},
"d9b76b4839b0662f7a242ddef9c1bbec": {"created":"2011-02-25T15:08:52.547Z","modified":"2011-03-02T10:16:47.698Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done +export to org","id":"d9b76b4839b0662f7a242ddef9c1bbec","comments":[],"log":[],"state":"done"},
"9f7a1ccc1109ca37eff095e3151ed2c9": {"created":"2011-02-25T15:08:55.269Z","modified":"2011-03-01T20:37:24.283Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done +export to txt","id":"9f7a1ccc1109ca37eff095e3151ed2c9","comments":[],"log":[],"state":"done"},
"bc7815df8b4b45efa9322e295b318ebb": {"created":"2011-02-25T15:09:13.697Z","modified":"2011-02-25T20:52:17.558Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@fixed Update +usage message","id":"bc7815df8b4b45efa9322e295b318ebb","comments":[],"log":[],"state":"fixed"},
"27a6d71d43dbb23ad2fa5364e4c3840b": {"created":"2011-02-25T15:09:33.164Z","modified":"2011-02-26T14:02:05.202Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done +sort tickets by last update","id":"27a6d71d43dbb23ad2fa5364e4c3840b","comments":[],"log":[],"state":"done"},
Expand Down Expand Up @@ -62,7 +62,8 @@
"06f63029dbfdaef97541edcd83715b67": {"created":"2011-02-28T18:47:59.820Z","modified":"2011-02-28T20:55:57.372Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@fixed repo name conflicts with settings file name","id":"06f63029dbfdaef97541edcd83715b67","comments":[],"log":[],"state":"fixed"},
"839f378ad9abc331b75c6dd1001fab2e": {"created":"2011-02-28T18:48:33.068Z","modified":"2011-02-28T18:48:33.068Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"+feature add support for multiple projects","id":"839f378ad9abc331b75c6dd1001fab2e","comments":[],"log":[],"state":"todo"},
"d8f3f5763fb709ea974b2520690ebf53": {"created":"2011-03-01T16:27:02.561Z","modified":"2011-03-01T16:52:42.242Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@done add signature for +comments\n","id":"d8f3f5763fb709ea974b2520690ebf53","comments":[{"date":"2011-03-01T16:50:04.472Z","author":{"user":"selead","email":"allselead@gmail.com"},"comment":"Test comment \nseems ok\n","id":"867cde23da69641774cd7a246f4a2099","sign":"94e1a962a155265efb8647bb38b627d3"}],"log":[],"state":"done"},
"71bdb51ad74d6bc68ad34c42dc663f23": {"created":"2011-03-02T10:04:45.195Z","modified":"2011-03-02T10:04:45.195Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo add +search in comments","id":"71bdb51ad74d6bc68ad34c42dc663f23","comments":[],"log":[],"state":"todo"}
"71bdb51ad74d6bc68ad34c42dc663f23": {"created":"2011-03-02T10:04:45.195Z","modified":"2011-03-02T10:04:45.195Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo add +search in comments","id":"71bdb51ad74d6bc68ad34c42dc663f23","comments":[],"log":[],"state":"todo"},
"4d9a79b7eb48983ccc12522e99df109a": {"created":"2011-03-02T10:17:44.211Z","modified":"2011-03-02T10:17:44.211Z","author":{"user":"selead","email":"allselead@gmail.com"},"text":"@todo add statistics +command","id":"4d9a79b7eb48983ccc12522e99df109a","comments":[],"log":[],"state":"todo"}
},
"states":{"initial":["todo","bug","accept"],"final":["done","fixed","closed","cancel"]}
}
2 changes: 1 addition & 1 deletion lib/export.coffee
Expand Up @@ -39,7 +39,7 @@ exports.toOrg = (tracker, filename) ->
out += "\n#+AUTHOR: #{tracker.config.get 'user'}\n#+EMAIL: #{tracker.config.get 'email'}\n"
out +="\n\n* #{tracker.name || tracker.config.get('user') + '\'s project'}[/]\n"
for t in tracker._sortTickets()
[text, tags] = util.searchAndRemoveTags t.text, ""
[text, tags] = util.searchAndDeactivateTags t.text, ""
text = text.replace('@' + t.state, '').replace /\n/g, '\n '
text = text.split "\n"
firstLine = text[0]
Expand Down
6 changes: 3 additions & 3 deletions lib/util.coffee
Expand Up @@ -526,23 +526,23 @@ exports.colorizeCommentNumber = (num, id, len=12) ->
return "#{num} #{id}"

###
Search tags in text and remove them from text
Search tags in text and remove tag prefixes
@param {String} text Text with tags
@param {String} tagPrefix Tag prefix. All tags in result will have this prefix. Default - ""
@param {RegExp} tagsRe Regulat Expression for searching tags. Default bings to "+tag"
@return {Array} result Result consists of new text at 0 position and tags list at 1 pos
@api public
###
exports.searchAndRemoveTags = (text, tagPrefix="", tagsRe=/(\+\S+)/g) ->
exports.searchAndDeactivateTags = (text, tagPrefix="", tagsRe=/(\+\S+)/g) ->
tags = []
result = text
match = text.match tagsRe
if match
for t in match
# todo add escape for other regexp characters
re = new RegExp t.replace( /\+/g, "\\+"), "g"
result = result.replace re, ""
result = result.replace re, t.substring 1
tags.push "#{tagPrefix}#{t.substring 1}"
[result, tags]

Expand Down

0 comments on commit cdac283

Please sign in to comment.