evertils 1.0.5 → 1.0.6
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.
- checksums.yaml +4 -4
- data/lib/evertils/actions/duplicate_previous.rb +21 -1
- data/lib/evertils/config.rb +4 -0
- data/lib/evertils/controllers/render.rb +7 -1
- data/lib/evertils/helpers/note.rb +1 -1
- data/lib/evertils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6cab6f39c8177d185542b7023e206d291c150998564c93734f18eca39df014b
|
4
|
+
data.tar.gz: 135ec4a854180bd71fe248c6da3a70690b7be4b9227485ac095b192d564da1c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fa1b85a44096a98953e2070161b84e2fb87e70ed667a7b55bea4f9639f759308785bcaf09ff58026f114267da175e202e933a827d8d4042f1cc8c2fd5536bf9
|
7
|
+
data.tar.gz: 0f82ec9c16f6aad968c4e0fb4e59120290d1e2063646d0868016898a2b7d53badb581f4a565becbf7151fa96947bf27ba11af3e44f2484761f8f87efae6b1c9b
|
@@ -27,7 +27,7 @@ module Evertils
|
|
27
27
|
# always skip weekends, even if there is a note for those days
|
28
28
|
next if %i[Sat Sun].include?(dow)
|
29
29
|
|
30
|
-
note_title = @args[:
|
30
|
+
note_title = previous_note_title(@args[:title_format], day)
|
31
31
|
note = @note_helper.model.find_note_contents(note_title).entity
|
32
32
|
|
33
33
|
Notify.info(" (#{iter}) #{note_title}")
|
@@ -37,6 +37,26 @@ module Evertils
|
|
37
37
|
|
38
38
|
@api.convert_to_xml(note.content).prepare
|
39
39
|
end
|
40
|
+
|
41
|
+
def previous_note_title(fmt, date)
|
42
|
+
# not a good solution but it works
|
43
|
+
# TODO: fix this
|
44
|
+
replacements = {
|
45
|
+
'%DOY%': date.yday,
|
46
|
+
'%MONTH_NAME%': date.strftime('%B'),
|
47
|
+
'%MONTH%': date.month,
|
48
|
+
'%DAY%': date.day,
|
49
|
+
'%DOW%': date.wday,
|
50
|
+
'%DOW_NAME%': date.strftime('%a'),
|
51
|
+
'%YEAR%': date.year,
|
52
|
+
'%WEEK%': date.cweek,
|
53
|
+
'%WEEK_START%': Date.commercial(date.year, date.cweek, 1),
|
54
|
+
'%WEEK_END%': Date.commercial(date.year, date.cweek, 5)
|
55
|
+
}
|
56
|
+
|
57
|
+
replacements.each_pair { |k, v| fmt.gsub!(k.to_s, v.to_s) }
|
58
|
+
fmt
|
59
|
+
end
|
40
60
|
end
|
41
61
|
end
|
42
62
|
end
|
data/lib/evertils/config.rb
CHANGED
@@ -90,6 +90,8 @@ module Evertils
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def translate_placeholders
|
93
|
+
title_format = @yml[:title].dup
|
94
|
+
|
93
95
|
@yml.map do |item|
|
94
96
|
REPLACEMENTS.each_pair do |k, v|
|
95
97
|
item.last.gsub!(k.to_s, v.to_s) if item.last.is_a? String
|
@@ -97,6 +99,8 @@ module Evertils
|
|
97
99
|
end
|
98
100
|
end
|
99
101
|
|
102
|
+
@yml[:title_format] = title_format unless @yml.key? :title_format
|
103
|
+
|
100
104
|
symbolize_keys(@yml)
|
101
105
|
self
|
102
106
|
end
|
@@ -4,7 +4,13 @@ module Evertils
|
|
4
4
|
module Controller
|
5
5
|
class Render < Controller::Base
|
6
6
|
def from_file(config)
|
7
|
-
@config = config.translate_placeholders.pluck(
|
7
|
+
@config = config.translate_placeholders.pluck(
|
8
|
+
:title,
|
9
|
+
:title_format,
|
10
|
+
:notebook,
|
11
|
+
:path,
|
12
|
+
:action
|
13
|
+
)
|
8
14
|
|
9
15
|
return Notify.warning("Note already exists\n- #{@link}") if note_exists?
|
10
16
|
|
@@ -34,7 +34,7 @@ module Evertils
|
|
34
34
|
|
35
35
|
# Wait for a note to exist
|
36
36
|
def wait_for_by_title(title, notebook, iterations = Evertils::Type::Base::MAX_SEARCH_SIZE)
|
37
|
-
Notify.info("Waiting for #{
|
37
|
+
Notify.info("Waiting for #{title}...")
|
38
38
|
note = find_note_by_title(title)
|
39
39
|
|
40
40
|
begin
|
data/lib/evertils/version.rb
CHANGED