evertils 0.3.20 → 0.3.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17268acd8544f52a11006ff8c4b3c81044ed091d
4
- data.tar.gz: 8fb9e15b270e5f536131dab79d28e88653d4692a
3
+ metadata.gz: 20c36a98c336c394c744d795875d052e68bef5bd
4
+ data.tar.gz: 87d09f3440aa416fc002952ea0097ff1ec485dbc
5
5
  SHA512:
6
- metadata.gz: 7749e738efbed98948dc90d75617294b58de883470887efafe180e9c5cb02b1509bf9b1f203f440d499e4897cfa61e7348351a2e6aac8cfa1459eb094a3d6e08
7
- data.tar.gz: 26c3644bd2cde2f72a0d07b9a51704f1d2c80d3dd13ecced6bde5158070e623170fb466792e8c7e09359c6ab01ad5682ad091198dbe61df80a97628f75ca66e8
6
+ metadata.gz: 8cd8e239d03e74d3c511f79442bf04da0b787e38fc25214232a8601d215459e7f6b3f851f738c769268208ec322e4b13672cc4b816b5768cf51699f2c6367545
7
+ data.tar.gz: 0f3df2fea341aac93f150e6facf06e9057f68083672c3974f62ddbe0ba02c5759f619e7f03ca54434380d5bd0ee55f502e437a6ec6b8f2213a6bcfe3c91d6752
@@ -12,7 +12,7 @@ module Evertils
12
12
  def message(text)
13
13
  Notify.error('Text argument is required', {}) if text.nil?
14
14
 
15
- note = @note_helper.find_note(:Daily)
15
+ note = @note_helper.wait_for(:Daily)
16
16
  edit_conf = {
17
17
  search: 'Triage',
18
18
  append: text
@@ -25,11 +25,7 @@ module Evertils
25
25
  #
26
26
  # @since 0.3.7
27
27
  def convert_to_xml(enml)
28
- # remove the xml declaration and DTD
29
- enml = enml.split("\n")
30
- enml.shift(2)
31
-
32
- @xml = from_str(enml.join)
28
+ @xml = from_str(enml)
33
29
  self
34
30
  end
35
31
  alias to_xml convert_to_xml
@@ -62,9 +58,9 @@ module Evertils
62
58
  # lets replace it with a new DTD if that is the case
63
59
  # @since 0.3.15
64
60
  def fix_dtd
65
- if @xml.children.first.is_a?(Text)
61
+ if @xml.children[0].is_a?(Text)
66
62
  # remove the existing broken DTD
67
- @xml.children.first.remove
63
+ @xml.children[0].remove
68
64
  # create a new one (note: output is overridden in DTD class defined
69
65
  # below ApiEnmlHandler)
70
66
  dtd = DTD.new('DOCTYPE', @xml)
@@ -15,7 +15,7 @@ module Evertils
15
15
 
16
16
  # Wait for a note to exist
17
17
  def wait_for(notebook)
18
- Notify.info('Waiting for...')
18
+ Notify.info("Waiting for #{notebook}...")
19
19
  note = find_note(notebook)
20
20
 
21
21
  # didn't find it the first time? wait and try again
@@ -36,22 +36,23 @@ module Evertils
36
36
  #
37
37
  # @since 0.3.15
38
38
  def add_weekly_note_link
39
+ wk_entity = @note_helper.wait_for(:Weekly).entity
39
40
  # parse the ENML note data into something we can work with
40
41
  xml = @api.from_str(@entity.content)
41
42
  # include the XML element builder
42
43
  xml_helper = Evertils::Helper.load('Xml', xml)
43
- # find the note entity we want to link
44
- linked_note = @note_helper.wait_for(:Weekly).entity
44
+ # internal URL for the linked note
45
+ note_url = @note_helper.internal_url_for(wk_entity)
45
46
 
46
47
  # don't add the note link if it is already there
47
- unless xml.search("a[href='#{@note_helper.internal_url_for(linked_note)}']").size.zero?
48
+ unless xml.search("a[href='#{note_url}']").size.zero?
48
49
  return Notify.warning('Weekly note link already exists here, exiting to avoid duplicate content')
49
50
  end
50
51
 
51
52
  a = xml_helper.a(
52
- @note_helper.internal_url_for(linked_note),
53
+ note_url,
53
54
  @format.date_templates[:Weekly]
54
- )
55
+ )
55
56
  li = xml_helper.li(a)
56
57
  br = xml_helper.br
57
58
 
@@ -28,7 +28,7 @@ module Evertils
28
28
  day = Date.today
29
29
  note = nil
30
30
 
31
- Notify.info('Searching for...')
31
+ Notify.info('Searching for last PQ...')
32
32
 
33
33
  (1..MAX_SEARCH_SIZE).each do |iter|
34
34
  day -= 1
@@ -45,8 +45,6 @@ module Evertils
45
45
  break unless note.nil?
46
46
  end
47
47
 
48
- raise 'Queue was not found' unless note
49
-
50
48
  @handler.convert_to_xml(note.content).prepare
51
49
  end
52
50
  end
@@ -22,22 +22,23 @@ module Evertils
22
22
  #
23
23
  # @since 0.3.15
24
24
  def add_daily_note_link
25
+ da_entity = @note_helper.wait_for(:Daily).entity
25
26
  # parse the ENML note data into something we can work with
26
27
  xml = @api.from_str(@entity.content)
27
28
  # include the XML element builder
28
29
  xml_helper = Evertils::Helper.load('Xml', xml)
29
- # find the note entity we want to link
30
- linked_note = @note_helper.wait_for(:Daily).entity
30
+ # internal URL for the linked note
31
+ note_url = @note_helper.internal_url_for(da_entity)
31
32
 
32
33
  # don't add the note link if it is already there
33
- unless xml.search("a[href='#{@note_helper.internal_url_for(linked_note)}']").size.zero?
34
+ unless xml.search("a[href='#{note_url}']").size.zero?
34
35
  return Notify.warning('Daily note link already exists here, exiting to avoid duplicate content')
35
36
  end
36
37
 
37
38
  a = xml_helper.a(
38
- @note_helper.internal_url_for(linked_note),
39
+ note_url,
39
40
  @format.date_templates[:Daily]
40
- )
41
+ )
41
42
  li = xml_helper.li(a)
42
43
  br = xml_helper.br
43
44
 
@@ -1,3 +1,3 @@
1
1
  module Evertils
2
- VERSION = '0.3.20'.freeze
2
+ VERSION = '0.3.21'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evertils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
4
+ version: 0.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe