Skip to content

Commit

Permalink
Ignore '#' comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jasperes committed Aug 11, 2017
1 parent d102e93 commit 7a0b559
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion test/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
person:
name: Jonathan
age: 99
email: [email protected]
email: [email protected] #inline comment

# A comment just to say: list of persons
persons:
-
name: Maria
Expand Down
5 changes: 2 additions & 3 deletions yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ function parse_yaml() {
fs="$(echo @|tr @ '\034')"

(
sed 's/--//g' |
sed 's/\"/\\\"/g' |
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
sed -ne 's/--//g; s/\"/\\\"/g; s/\#.*//g; s/\s*$//g;' \
-e "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s[:-]$s\(.*\)$s\$|\1$fs\2$fs\3|p" |
awk -F"$fs" '{
indent = length($1)/2;
Expand Down

0 comments on commit 7a0b559

Please sign in to comment.