doing 1.0.92 → 2.0.5.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS +19 -0
  3. data/CHANGELOG.md +596 -0
  4. data/COMMANDS.md +1181 -0
  5. data/Gemfile +2 -0
  6. data/Gemfile.lock +110 -0
  7. data/LICENSE +23 -0
  8. data/README.md +15 -699
  9. data/Rakefile +79 -0
  10. data/_config.yml +1 -0
  11. data/bin/doing +1012 -486
  12. data/doing.fish +278 -0
  13. data/doing.gemspec +34 -0
  14. data/doing.rdoc +1759 -0
  15. data/example_plugin.rb +209 -0
  16. data/generate_completions.sh +4 -0
  17. data/img/doing-colors.jpg +0 -0
  18. data/img/doing-printf-wrap-800.jpg +0 -0
  19. data/img/doing-show-note-formatting-800.jpg +0 -0
  20. data/lib/completion/_doing.zsh +151 -0
  21. data/lib/completion/doing.bash +416 -0
  22. data/lib/completion/doing.fish +278 -0
  23. data/lib/doing/array.rb +8 -0
  24. data/lib/doing/cli_status.rb +66 -0
  25. data/lib/doing/colors.rb +136 -0
  26. data/lib/doing/configuration.rb +312 -0
  27. data/lib/doing/errors.rb +102 -0
  28. data/lib/doing/hash.rb +31 -0
  29. data/lib/doing/hooks.rb +59 -0
  30. data/lib/doing/item.rb +155 -0
  31. data/lib/doing/log_adapter.rb +342 -0
  32. data/lib/doing/markdown_document_listener.rb +174 -0
  33. data/lib/doing/note.rb +59 -0
  34. data/lib/doing/pager.rb +95 -0
  35. data/lib/doing/plugin_manager.rb +208 -0
  36. data/lib/doing/plugins/export/csv_export.rb +48 -0
  37. data/lib/doing/plugins/export/html_export.rb +83 -0
  38. data/lib/doing/plugins/export/json_export.rb +140 -0
  39. data/lib/doing/plugins/export/markdown_export.rb +85 -0
  40. data/lib/doing/plugins/export/taskpaper_export.rb +34 -0
  41. data/lib/doing/plugins/export/template_export.rb +141 -0
  42. data/lib/doing/plugins/import/cal_to_json.scpt +0 -0
  43. data/lib/doing/plugins/import/calendar_import.rb +76 -0
  44. data/lib/doing/plugins/import/doing_import.rb +144 -0
  45. data/lib/doing/plugins/import/timing_import.rb +78 -0
  46. data/lib/doing/string.rb +347 -0
  47. data/lib/doing/symbol.rb +16 -0
  48. data/lib/doing/time.rb +18 -0
  49. data/lib/doing/util.rb +186 -0
  50. data/lib/doing/version.rb +1 -1
  51. data/lib/doing/wwid.rb +1868 -2356
  52. data/lib/doing/wwidfile.rb +117 -0
  53. data/lib/doing.rb +44 -4
  54. data/lib/examples/commands/wiki.rb +81 -0
  55. data/lib/examples/plugins/hooks.rb +22 -0
  56. data/lib/examples/plugins/say_export.rb +202 -0
  57. data/lib/examples/plugins/templates/wiki.css +169 -0
  58. data/lib/examples/plugins/templates/wiki.haml +27 -0
  59. data/lib/examples/plugins/templates/wiki_index.haml +18 -0
  60. data/lib/examples/plugins/wiki_export.rb +87 -0
  61. data/lib/templates/doing-markdown.erb +5 -0
  62. data/man/doing.1 +964 -0
  63. data/man/doing.1.html +711 -0
  64. data/man/doing.1.ronn +600 -0
  65. data/package-lock.json +3 -0
  66. data/rdoc_to_mmd.rb +42 -0
  67. data/rdocfixer.rb +13 -0
  68. data/scripts/generate_bash_completions.rb +210 -0
  69. data/scripts/generate_fish_completions.rb +201 -0
  70. data/scripts/generate_zsh_completions.rb +164 -0
  71. metadata +82 -7
  72. data/lib/doing/helpers.rb +0 -191
  73. data/lib/doing/markdown_export.rb +0 -16
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ # title: HTML Export
4
+ # description: Export styled HTML view of data
5
+ # author: Brett Terpstra
6
+ # url: https://brettterpstra.com
7
+ module Doing
8
+ class WikiExport
9
+
10
+ def self.settings
11
+ {
12
+ trigger: 'wiki',
13
+ templates: [
14
+ { name: 'wiki_page', trigger: 'wiki.?page' },
15
+ { name: 'wiki_index', trigger: 'wiki.?index' },
16
+ { name: 'wiki_css', trigger: 'wiki.?css' }
17
+ ]
18
+ }
19
+ end
20
+
21
+ def self.template(trigger)
22
+ if trigger =~ /css/
23
+ IO.read(File.join(File.dirname(__FILE__), 'templates/wiki.css'))
24
+ elsif trigger =~ /index/
25
+ IO.read(File.join(File.dirname(__FILE__), 'templates/wiki_index.haml'))
26
+ else
27
+ IO.read(File.join(File.dirname(__FILE__), 'templates/wiki.haml'))
28
+ end
29
+ end
30
+
31
+ def self.render(wwid, items, variables: {})
32
+ return if items.nil?
33
+
34
+ opt = variables[:options]
35
+
36
+ items_out = []
37
+ items.each do |i|
38
+ # if i.has_key?('note')
39
+ # note = '<span class="note">' + i.note.map{|n| n.strip }.join('<br>') + '</span>'
40
+ # else
41
+ # note = ''
42
+ # end
43
+ if String.method_defined? :force_encoding
44
+ title = i.title.force_encoding('utf-8').link_urls
45
+ note = i.note.map { |line| line.force_encoding('utf-8').strip.link_urls } if i.note
46
+ else
47
+ title = i.title.link_urls
48
+ note = i.note.map { |line| line.strip.link_urls } if i.note
49
+ end
50
+
51
+ interval = wwid.get_interval(i) if i.title =~ /@done\((\d{4}-\d\d-\d\d \d\d:\d\d.*?)\)/ && opt[:times]
52
+ interval ||= false
53
+
54
+ title.gsub!(/(@([^ (]+)(\(.*?\))?)/im, '<a class="tag" href="\2.html">\1</a>').strip
55
+
56
+ items_out << {
57
+ date: i.date.strftime('%a %-I:%M%p'),
58
+ title: title, #+ " #{note}"
59
+ note: note,
60
+ time: interval,
61
+ section: i.section
62
+ }
63
+ end
64
+
65
+ template = if wwid.config['export_templates']['wiki_page'] && File.exist?(File.expand_path(wwid.config['export_templates']['wiki_haml']))
66
+ IO.read(File.expand_path(wwid.config['export_templates']['wiki_page']))
67
+ else
68
+ self.template('wiki_html')
69
+ end
70
+
71
+ style = if wwid.config['export_templates']['wiki_css'] && File.exist?(File.expand_path(wwid.config['export_templates']['wiki_css']))
72
+ IO.read(File.expand_path(wwid.config['export_templates']['wiki_css']))
73
+ else
74
+ self.template('wiki_css')
75
+ end
76
+
77
+ totals = opt[:totals] ? wwid.tag_times(format: :html, sort_by_name: opt[:sort_tags], sort_order: opt[:tag_order]) : ''
78
+ engine = Haml::Engine.new(template)
79
+ Doing.logger.debug('Wiki Export:', "#{items_out.count} items output to #{variables[:page_title]} wiki page")
80
+ @out = engine.render(Object.new,
81
+ { :@items => items_out, :@page_title => variables[:page_title], :@style => style, :@totals => totals })
82
+ end
83
+
84
+ Doing::Plugins.register 'wiki', :export, self
85
+ end
86
+ end
87
+
@@ -0,0 +1,5 @@
1
+ # <%= @page_title %>
2
+ <% @items.each do |i| %>
3
+ - [<%= i[:done] %>] <%= i[:date] %> <%= i[:title] %> <% if i[:time] && i[:time] != "00:00:00" %>[**<%= i[:time] %>**]<% end %><% if i[:note].length.positive? %><%= "\n\n " + i[:note].map{|n| n.strip }.join("\n ") %><% end %><% end %>
4
+
5
+ <%= @totals %>