rawfeed 0.1.2 → 0.1.3
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/_data/resume.yml +1 -0
- data/lib/rawfeed/datelang.rb +12 -12
- data/lib/rawfeed/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: 5c77c26cafbcdaddf6d5297d5ec37d0e6912e305b31055c412d5f3fb595e6011
|
|
4
|
+
data.tar.gz: ee87b78c301ed6862181631c4b71938c8fbeb67133262f915218dc63943e9706
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb7020880c461a817305c26e2a5076cd7418b2509aaf0207e5b3352e071f4ea86595a24bb9a9791043e23d122686131066b3fb33f062fc0a5c2f16f9e676dd6e
|
|
7
|
+
data.tar.gz: 99d68cc1a6ea32e42c900f8e3bf2d6bc4561bad407ee50bd83449586e562ba6aba4bcfcf4b8023acc30260f98e893e2fe8ae52ba0ff46e157128c08fcf0c9a9e
|
data/_data/resume.yml
CHANGED
|
@@ -143,6 +143,7 @@ body:
|
|
|
143
143
|
|
|
144
144
|
# section: [Certificates]
|
|
145
145
|
# Full links will only appear in print mode. Online and PDF modes are clickable.
|
|
146
|
+
# TODO: Bugfix: Quando tem muitos certificados, existe uma quebra de espaço absurda na impressão
|
|
146
147
|
certificates:
|
|
147
148
|
enable: true
|
|
148
149
|
caption: Certificates
|
data/lib/rawfeed/datelang.rb
CHANGED
|
@@ -36,7 +36,13 @@ module Rawfeed
|
|
|
36
36
|
return "[datelang: invalid date '#{date_input}']" unless date
|
|
37
37
|
|
|
38
38
|
formatted = date.strftime(format)
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
# Automatically detects month type based on format
|
|
41
|
+
if format.include?("%B")
|
|
42
|
+
replace_months(formatted, data, :full)
|
|
43
|
+
else
|
|
44
|
+
replace_months(formatted, data, :short)
|
|
45
|
+
end
|
|
40
46
|
end
|
|
41
47
|
|
|
42
48
|
private
|
|
@@ -44,23 +50,18 @@ module Rawfeed
|
|
|
44
50
|
def parse_args(text, context)
|
|
45
51
|
args = {}
|
|
46
52
|
|
|
47
|
-
# captures tokens respecting quoted strings
|
|
48
53
|
tokens = text.scan(/"[^"]*"|\S+/).map { |t| t.strip }
|
|
49
54
|
|
|
50
55
|
tokens.each do |tok|
|
|
51
56
|
if tok.include?(':')
|
|
52
57
|
key, raw_val = tok.split(':', 2)
|
|
53
|
-
# value in quotes -> literal
|
|
54
58
|
if raw_val.start_with?('"') && raw_val.end_with?('"')
|
|
55
59
|
val = raw_val[1..-2]
|
|
56
60
|
else
|
|
57
|
-
# unquoted value -> can be a Liquid variable (e.g., site.date.format)
|
|
58
|
-
# we render "{{ value }}" in the context to get its actual content
|
|
59
61
|
val = Liquid::Template.parse("{{ #{raw_val} }}").render(context).strip
|
|
60
62
|
end
|
|
61
63
|
args[key.to_sym] = val
|
|
62
64
|
else
|
|
63
|
-
# standalone token (e.g: page.date)
|
|
64
65
|
rendered = Liquid::Template.parse("{{ #{tok} }}").render(context).strip
|
|
65
66
|
args[:date] = rendered unless rendered.empty?
|
|
66
67
|
end
|
|
@@ -74,7 +75,6 @@ module Rawfeed
|
|
|
74
75
|
when Date then input
|
|
75
76
|
when Time then input.to_date
|
|
76
77
|
else
|
|
77
|
-
# if it is string like "2025-10-13 12:34:00 -0300" etc, Date.parse works
|
|
78
78
|
begin
|
|
79
79
|
Date.parse(input.to_s)
|
|
80
80
|
rescue ArgumentError
|
|
@@ -83,13 +83,13 @@ module Rawfeed
|
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
-
def replace_months(str, data)
|
|
87
|
-
|
|
86
|
+
def replace_months(str, data, type)
|
|
87
|
+
months_key = (type == :full ? "months_full" : "months_short")
|
|
88
|
+
months = data[months_key] || []
|
|
89
|
+
|
|
90
|
+
months.each_with_index do |m, i|
|
|
88
91
|
next if i.zero?
|
|
89
92
|
str = str.gsub(Date::MONTHNAMES[i], m)
|
|
90
|
-
end
|
|
91
|
-
data["months_short"].each_with_index do |m, i|
|
|
92
|
-
next if i.zero?
|
|
93
93
|
str = str.gsub(Date::ABBR_MONTHNAMES[i], m)
|
|
94
94
|
end
|
|
95
95
|
str
|
data/lib/rawfeed/version.rb
CHANGED