doing 1.0.91 → 2.0.3.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS +19 -0
- data/CHANGELOG.md +590 -0
- data/COMMANDS.md +1181 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +110 -0
- data/LICENSE +23 -0
- data/README.md +15 -699
- data/Rakefile +79 -0
- data/_config.yml +1 -0
- data/bin/doing +1012 -486
- data/doing.fish +278 -0
- data/doing.gemspec +34 -0
- data/doing.rdoc +1759 -0
- data/example_plugin.rb +209 -0
- data/generate_completions.sh +4 -0
- data/img/doing-colors.jpg +0 -0
- data/img/doing-printf-wrap-800.jpg +0 -0
- data/img/doing-show-note-formatting-800.jpg +0 -0
- data/lib/completion/_doing.zsh +151 -0
- data/lib/completion/doing.bash +416 -0
- data/lib/completion/doing.fish +278 -0
- data/lib/doing/array.rb +8 -0
- data/lib/doing/cli_status.rb +66 -0
- data/lib/doing/colors.rb +136 -0
- data/lib/doing/configuration.rb +310 -0
- data/lib/doing/errors.rb +102 -0
- data/lib/doing/hash.rb +31 -0
- data/lib/doing/hooks.rb +59 -0
- data/lib/doing/item.rb +155 -0
- data/lib/doing/log_adapter.rb +342 -0
- data/lib/doing/markdown_document_listener.rb +174 -0
- data/lib/doing/note.rb +59 -0
- data/lib/doing/pager.rb +95 -0
- data/lib/doing/plugin_manager.rb +208 -0
- data/lib/doing/plugins/export/csv_export.rb +48 -0
- data/lib/doing/plugins/export/html_export.rb +83 -0
- data/lib/doing/plugins/export/json_export.rb +140 -0
- data/lib/doing/plugins/export/markdown_export.rb +85 -0
- data/lib/doing/plugins/export/taskpaper_export.rb +34 -0
- data/lib/doing/plugins/export/template_export.rb +141 -0
- data/lib/doing/plugins/import/cal_to_json.scpt +0 -0
- data/lib/doing/plugins/import/calendar_import.rb +76 -0
- data/lib/doing/plugins/import/doing_import.rb +144 -0
- data/lib/doing/plugins/import/timing_import.rb +78 -0
- data/lib/doing/string.rb +346 -0
- data/lib/doing/symbol.rb +16 -0
- data/lib/doing/time.rb +18 -0
- data/lib/doing/util.rb +186 -0
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +1831 -2358
- data/lib/doing/wwidfile.rb +117 -0
- data/lib/doing.rb +44 -4
- data/lib/examples/commands/wiki.rb +80 -0
- data/lib/examples/plugins/hooks.rb +22 -0
- data/lib/examples/plugins/say_export.rb +202 -0
- data/lib/examples/plugins/templates/wiki.css +169 -0
- data/lib/examples/plugins/templates/wiki.haml +27 -0
- data/lib/examples/plugins/templates/wiki_index.haml +18 -0
- data/lib/examples/plugins/wiki_export.rb +87 -0
- data/lib/templates/doing-markdown.erb +5 -0
- data/man/doing.1 +964 -0
- data/man/doing.1.html +711 -0
- data/man/doing.1.ronn +600 -0
- data/package-lock.json +3 -0
- data/rdoc_to_mmd.rb +42 -0
- data/rdocfixer.rb +13 -0
- data/scripts/generate_bash_completions.rb +210 -0
- data/scripts/generate_fish_completions.rb +201 -0
- data/scripts/generate_zsh_completions.rb +164 -0
- metadata +82 -6
- data/lib/doing/helpers.rb +0 -191
@@ -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 %>
|