nora_mark 0.2beta19 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/dependabot.yml +8 -0
  4. data/.github/workflows/test.yml +19 -0
  5. data/.rubocop.yml +3 -0
  6. data/.travis.yml +2 -2
  7. data/CHANGELOG.md +5 -0
  8. data/Gemfile +0 -1
  9. data/README.md +1 -2
  10. data/Rakefile +1 -4
  11. data/lib/nora_mark/document.rb +14 -14
  12. data/lib/nora_mark/extensions.rb +6 -6
  13. data/lib/nora_mark/html/abstract_node_writer.rb +2 -1
  14. data/lib/nora_mark/html/context.rb +16 -14
  15. data/lib/nora_mark/html/default_transformer.rb +36 -38
  16. data/lib/nora_mark/html/frontmatter_writer.rb +2 -2
  17. data/lib/nora_mark/html/generator.rb +19 -22
  18. data/lib/nora_mark/html/pages.rb +13 -14
  19. data/lib/nora_mark/html/paragraph_writer.rb +24 -26
  20. data/lib/nora_mark/html/raw_text_block_writer.rb +2 -1
  21. data/lib/nora_mark/html/tag_writer.rb +14 -13
  22. data/lib/nora_mark/html/util.rb +5 -5
  23. data/lib/nora_mark/node.rb +45 -55
  24. data/lib/nora_mark/node_set.rb +1 -1
  25. data/lib/nora_mark/node_util.rb +7 -8
  26. data/lib/nora_mark/parser.kpeg.rb +16 -16
  27. data/lib/nora_mark/parser.rb +1 -3
  28. data/lib/nora_mark/rake_task.rb +16 -20
  29. data/lib/nora_mark/transformer.rb +13 -15
  30. data/lib/nora_mark/version.rb +1 -1
  31. data/lib/nora_mark.rb +0 -4
  32. data/lib/tilt/nora_mark.rb +1 -1
  33. data/nora_mark.gemspec +6 -5
  34. data/spec/extensions_spec.rb +1 -2
  35. data/spec/fixtures/test-plugins/nora_mark_tester.rb +3 -1
  36. data/spec/node_spec.rb +69 -49
  37. data/spec/nokogiri_test_helper.rb +9 -7
  38. data/spec/nora_mark_spec.rb +437 -498
  39. data/spec/spec_helper.rb +1 -5
  40. data/spec/tilt_spec.rb +1 -1
  41. data/spec/transformer_spec.rb +16 -18
  42. metadata +36 -27
@@ -3,18 +3,18 @@ module Nokogiri
3
3
  class Element
4
4
  def selector remove_id: true
5
5
  sel = name
6
- if !remove_id && !self['id'].nil?
6
+ if !remove_id && !self['id'].nil?
7
7
  sel = sel + '#' + self['id'].split(' ').join('#')
8
8
  end
9
9
  if !self['class'].nil?
10
10
  sel = sel + '.' + self['class'].split(' ').join('.')
11
11
  end
12
- attributes.select{|k,v| k != 'class' && k != 'id'}.each {
13
- |name, value|
12
+ attributes.select { |k, _v| k != 'class' && k != 'id' }.each { |name, value|
14
13
  sel = sel + "[#{name}='#{value}']"
15
14
  }
16
15
  sel
17
16
  end
17
+
18
18
  def selector_and_text remove_id: true
19
19
  [selector(remove_id: remove_id), text]
20
20
  end
@@ -22,18 +22,20 @@ module Nokogiri
22
22
  def child_loop
23
23
  yield self
24
24
  end
25
+
25
26
  def child_a(index)
26
27
  element_children[index].selector_and_text
27
- end
28
+ end
29
+
28
30
  def selector_and_children remove_id: true
29
- [selector(remove_id: remove_id)] + children.select{|c| c.elem? || c.text.strip.size > 0}.map{|c|
30
- if !c.elem?
31
+ [selector(remove_id: remove_id)] + children.select { |c| c.elem? || c.text.strip.size > 0 }.map { |c|
32
+ if !c.elem?
31
33
  c.text
32
34
  elsif c.element_children.size == 0
33
35
  c.selector_and_text remove_id: remove_id
34
36
  else
35
37
  c.selector_and_children remove_id: remove_id
36
- end
38
+ end
37
39
  }
38
40
  end
39
41
  end