-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement parse.map for mapping RIS tags to human-friendly names
- Loading branch information
1 parent
4d37e51
commit bf5df51
Showing
12 changed files
with
2,503 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
NR == 1 { | ||
printf "|" | ||
for (i=1; i<NF; i=i+1) { printf "%s|", $i } | ||
printf "\n" | ||
printf "|" | ||
for (i=1; i<NF; i=i+1) { printf ":--|", $i } | ||
printf "\n" | ||
next | ||
} | ||
|
||
{ | ||
printf "|" | ||
for (i=1; i<NF; i=i+1) { | ||
if ($i == "N/A") { | ||
printf "_%s_|", $i | ||
} else { | ||
printf "%s|", $i | ||
} | ||
} | ||
printf "\n" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(to_entries | map(.key | split(".") | last) | unique) as $all_tags | ||
| to_entries | ||
| group_by(.key | split(".") | first) | ||
| map(reduce .[] as $item ({}; . + { TY: ($item.key | split(".") | first) | ||
, ($item.key | split(".") | last): $item.value | ||
})) | ||
| sort_by(.TY) | ||
| ([["Type", "TY"] + $all_tags]) + map([.TY, "@type"] + (. as $format | ($all_tags | map($format[.] // "N/A")))) | ||
| map(join(",")) | ||
| join("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# INPUT | ||
# A,1 | ||
# B,2 | ||
# | ||
# OUTPUT | ||
# | TY | Description | | ||
# |:---|:------------| | ||
# | A | 1 | | ||
# | B | 2 | | ||
|
||
|
||
BEGIN { | ||
print "| TY | Description |" | ||
print "|:---|:------------|" | ||
} | ||
{ | ||
print "|" $1 "|" $2 "|" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# INPUT | ||
# {"A": "1", "B": "2"} | ||
# OUTPUT | ||
# "A,1" | ||
# "B,2" | ||
|
||
to_entries | map("\(.key),\(.value)") | join("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.