aoc_generator 0.1.4 → 0.1.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/CHANGELOG.md +9 -1
- data/Gemfile.lock +1 -1
- data/lib/advent_of_code_generator/generator.rb +2 -6
- data/lib/advent_of_code_generator/html_parser.rb +11 -6
- data/lib/advent_of_code_generator.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: 224ddd170a1b90b1f49ec1b74ae9f866469dfe4613f7e79c74fe21bc7e50df6e
|
4
|
+
data.tar.gz: ce15c6c8269ce2fbfcbb9a13c435c2ff05f3f87595ab073eec0452fbd261ec4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39b6cb3425c18ce2f88628e4d44a603481578e3cdb49096e252c10ff2edc1994c748ba859be5f67c6b6f3360331dd0caf4bbaad608e573939b13f1875fb018fb
|
7
|
+
data.tar.gz: 29e5215ba788af0c801933c96167f1872bd1c54f722257c9118fa981cd5a9b49b3821cc7f5f64a2bb1592121bd9a2c1cebc2ab651d7a79e0c840d4f409045767
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [0.1.
|
3
|
+
## [0.1.6] - 2024-11-29
|
4
|
+
|
5
|
+
- Handle <ul> and <ol> HTML elements
|
6
|
+
|
7
|
+
## [0.1.5] - 2024-11-28
|
8
|
+
|
9
|
+
- Generate main file with class methods, rather than instance methods
|
10
|
+
|
11
|
+
## [0.1.4]
|
4
12
|
|
5
13
|
- Add test data to spec file
|
6
14
|
|
data/Gemfile.lock
CHANGED
@@ -65,15 +65,11 @@ module AdventOfCodeGenerator
|
|
65
65
|
module #{@username.capitalize}
|
66
66
|
module Year#{@year}
|
67
67
|
class Day#{@day}
|
68
|
-
def
|
69
|
-
@input = input
|
70
|
-
end
|
71
|
-
|
72
|
-
def part_one
|
68
|
+
def self.part_one(input)
|
73
69
|
raise NotImplementedError
|
74
70
|
end
|
75
71
|
|
76
|
-
def part_two
|
72
|
+
def self.part_two(input)
|
77
73
|
raise NotImplementedError
|
78
74
|
end
|
79
75
|
end
|
@@ -49,15 +49,20 @@ module AdventOfCodeGenerator
|
|
49
49
|
|
50
50
|
def process_node(node)
|
51
51
|
case node.name
|
52
|
-
when "h2"
|
53
|
-
|
54
|
-
when "
|
55
|
-
|
56
|
-
when "pre"
|
57
|
-
"```sh\n#{node.text.strip}\n```\n"
|
52
|
+
when "h2" then "## #{node.text}\n"
|
53
|
+
when "ul" then "#{process_list(node, "-")}\n"
|
54
|
+
when "ol" then"#{process_list(node, "1.")}\n"
|
55
|
+
when "p" then "#{process_paragraph(node)}\n"
|
56
|
+
when "pre" then "```sh\n#{node.text.strip}\n```\n"
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
60
|
+
def process_list(list_node, marker)
|
61
|
+
list_node.css("li").map do |item|
|
62
|
+
"#{marker} #{process_paragraph(item)}"
|
63
|
+
end.join("\n")
|
64
|
+
end
|
65
|
+
|
61
66
|
def process_paragraph(para)
|
62
67
|
para.inner_html
|
63
68
|
.gsub(%r{<a[^>]*href="([^"]*)"[^>]*>(.*?)</a>}, '[\2](\1)')
|