immosquare-cleaner 0.1.114 → 0.1.115
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/immosquare-cleaner/markdown.rb +23 -4
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/package.json +2 -2
- 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: 19779dc732954ca8de22b3c3fa9ed64570df1c5962ddd692d3eaead3795bcb33
|
|
4
|
+
data.tar.gz: 8482c46bb1437146f369e6a9e3995f29e9e8e240b08f54adabf2bc22211bf74f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6651cf24dc96341e01b8e7d94977dbb476725f9d86b2aa7a75f815d36d14ccc2b923511b28aae3d9634e5579d454d630739efab8c7caf4bfb8c490afb6f7dcc
|
|
7
|
+
data.tar.gz: 8f10906affbec34cf93fc92c26af2cf8cf9f9c10e48b7aedfc364fdb5b96a2931f365a503963aa7aa91a8edc6e0b34e0e91e74b022a7488b6719ad3e9ddb2888
|
|
@@ -92,7 +92,15 @@ module ImmosquareCleaner
|
|
|
92
92
|
##============================================================##
|
|
93
93
|
elements_size = []
|
|
94
94
|
rows = array_to_clean.map do |line|
|
|
95
|
-
|
|
95
|
+
##============================================================##
|
|
96
|
+
## Only the delimiting pipes are dropped, never empty cells:
|
|
97
|
+
## a table may legitimately hold one (an unnamed first header
|
|
98
|
+
## above a column of row labels, a value that does not apply).
|
|
99
|
+
## Rejecting empty cells would shift every following cell one
|
|
100
|
+
## column to the left and silently file values under the wrong
|
|
101
|
+
## header. `split("|", -1)` keeps trailing empty fields.
|
|
102
|
+
##============================================================##
|
|
103
|
+
cells = line.strip.delete_prefix("|").delete_suffix("|").split("|", -1).map(&:strip)
|
|
96
104
|
|
|
97
105
|
##============================================================##
|
|
98
106
|
## We increase the size of the array if needed
|
|
@@ -119,7 +127,12 @@ module ImmosquareCleaner
|
|
|
119
127
|
line = row.each_with_index.map do |cell, index|
|
|
120
128
|
max_length = elements_size[index]
|
|
121
129
|
cell =
|
|
122
|
-
|
|
130
|
+
##============================================================##
|
|
131
|
+
## At least one dash is required: an empty cell must stay
|
|
132
|
+
## empty, not be filled with dashes that would read as a
|
|
133
|
+
## separator row.
|
|
134
|
+
##============================================================##
|
|
135
|
+
if cell&.match(/\A-+\z/)
|
|
123
136
|
"-" * max_length
|
|
124
137
|
else
|
|
125
138
|
cell.to_s.ljust(max_length)
|
|
@@ -132,9 +145,15 @@ module ImmosquareCleaner
|
|
|
132
145
|
end
|
|
133
146
|
|
|
134
147
|
def cleaned_line(previous_line, current_line)
|
|
135
|
-
|
|
148
|
+
cleaned_current = current_line.rstrip
|
|
149
|
+
|
|
150
|
+
##============================================================##
|
|
151
|
+
## The very first line of the file has no predecessor, so no
|
|
152
|
+
## list spacing to decide — but it still gets its trailing
|
|
153
|
+
## whitespace stripped like any other line.
|
|
154
|
+
##============================================================##
|
|
155
|
+
return ["#{cleaned_current}\n"] if !previous_line
|
|
136
156
|
|
|
137
|
-
cleaned_current = current_line.rstrip
|
|
138
157
|
cleaned_previous = previous_line.rstrip
|
|
139
158
|
blank_line = current_line.gsub("\n", "").empty?
|
|
140
159
|
previous_is_list = cleaned_previous.lstrip.start_with?("*", "-", "+")
|
data/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@babel/parser": "^8.0.4",
|
|
11
11
|
"@eslint/js": "^10.0.1",
|
|
12
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
13
|
-
"@typescript-eslint/parser": "^8.
|
|
12
|
+
"@typescript-eslint/eslint-plugin": "^8.67.0",
|
|
13
|
+
"@typescript-eslint/parser": "^8.67.0",
|
|
14
14
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
15
15
|
"eslint": "^10.8.1",
|
|
16
16
|
"eslint-plugin-align-assignments": "^1.1.2",
|