diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 2015-04-27 17:23:19 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2015-04-27 17:23:19 +0000 |
commit | 788ca347b816afd83b2885e0c79aeeb88649b2ab (patch) | |
tree | 2743e923a1c968c5a2a8292b75bf32c2e50bfbb3 /contrib/libxo/xolint | |
parent | 483117a6464dae1a36a96520adb50a53d7efb725 (diff) | |
download | src-788ca347b816afd83b2885e0c79aeeb88649b2ab.tar.gz src-788ca347b816afd83b2885e0c79aeeb88649b2ab.zip |
Upgrade libxo to 0.3.2.
Obtained from: https://github.com/Juniper/libxo/tree/0.3.2
Requested by: Phil Shafer <phil@juniper.net>
This import incorporates local change 279966.
Local change 276260 has been merged-in.
Notes
Notes:
svn path=/head/; revision=282100
Diffstat (limited to 'contrib/libxo/xolint')
-rw-r--r-- | contrib/libxo/xolint/Makefile.am | 3 | ||||
-rw-r--r-- | contrib/libxo/xolint/xolint.1 | 2 | ||||
-rwxr-xr-x | contrib/libxo/xolint/xolint.pl | 63 |
3 files changed, 57 insertions, 11 deletions
diff --git a/contrib/libxo/xolint/Makefile.am b/contrib/libxo/xolint/Makefile.am index a847e72c784c..ec5c36d86b00 100644 --- a/contrib/libxo/xolint/Makefile.am +++ b/contrib/libxo/xolint/Makefile.am @@ -12,3 +12,6 @@ EXTRA_DIST = xolint.1 xolint.pl install-exec-hook: install ${srcdir}/xolint.pl ${DESTDIR}${bindir}/xolint + +uninstall-hook: + rm -f ${DESTDIR}${bindir}/xolint diff --git a/contrib/libxo/xolint/xolint.1 b/contrib/libxo/xolint/xolint.1 index fcf7bcdeec73..16a59fc91fdd 100644 --- a/contrib/libxo/xolint/xolint.1 +++ b/contrib/libxo/xolint/xolint.1 @@ -99,6 +99,6 @@ https://github.com/Juniper/libxo/releases The .Nm libxo library was added in -.Fx 10.1 . +.Fx 11.0 . .Sh AUTHOR Phil Shafer diff --git a/contrib/libxo/xolint/xolint.pl b/contrib/libxo/xolint/xolint.pl index 427edf7aa95d..515f7faaf77f 100755 --- a/contrib/libxo/xolint/xolint.pl +++ b/contrib/libxo/xolint/xolint.pl @@ -347,32 +347,32 @@ sub check_field { error("only one field role can be used (" . join(", ", @roles) . ")") if $#roles > 0; - # Field is a note, label, or title - if ($field[0] =~ /[DLNT]/) { + # Field is a color, note, label, or title + if ($field[0] =~ /[CDLNT]/) { - #@ Potential missing slash after N, L, or T with format + #@ Potential missing slash after C, D, N, L, or T with format #@ xo_emit("{T:%6.6s}\n", "Max"); #@ should be: #@ xo_emit("{T:/%6.6s}\n", "Max"); #@ The "%6.6s" will be a literal, not a field format. While #@ it's possibly valid, it's likely a missing "/". - info("potential missing slash after N, L, or T with format") + info("potential missing slash after C, D, N, L, or T with format") if $field[1] =~ /%/; #@ An encoding format cannot be given (roles: DNLT) #@ xo_emit("{T:Max//%s}", "Max"); - #@ Fields with the D, N, L, and T roles are not emitted in + #@ Fields with the C, D, N, L, and T roles are not emitted in #@ the 'encoding' style (JSON, XML), so an encoding format #@ would make no sense. error("encoding format cannot be given when content is present") if $field[3]; } - # Field is a decoration, label, or title - if ($field[0] =~ /DLN/) { - #@ Format cannot be given when content is present (roles: DLN) + # Field is a color, decoration, label, or title + if ($field[0] =~ /[CDLN]/) { + #@ Format cannot be given when content is present (roles: CDLN) #@ xo_emit("{N:Max/%6.6s}", "Max"); - #@ Fields with the D, L, or N roles can't have both + #@ Fields with the C, D, L, or N roles can't have both #@ static literal content ("{L:Label}") and a #@ format ("{L:/%s}"). #@ This error will also occur when the content has a backslash @@ -383,6 +383,49 @@ sub check_field { if $field[1] && $field[2]; } + # Field is a color/effect + if ($field[0] =~ /C/) { + if ($field[1]) { + my $val; + my @sub = split(/,/, $field[1]); + grep { s/^\s*//; s/\s*$//; } @sub; + + for $val (@sub) { + if ($val =~ /^(default,black,red,green,yellow,blue,magenta,cyan,white)$/) { + + #@ Field has color without fg- or bg- (role: C) + #@ xo_emit("{C:green}{:foo}{C:}", x); + #@ Should be: + #@ xo_emit("{C:fg-green}{:foo}{C:}", x); + #@ Colors must be prefixed by either "fg-" or "bg-". + error("Field has color without fg- or bg- (role: C)"); + + } elsif ($val =~ /^(fg|bg)-(default|black|red|green|yellow|blue|magenta|cyan|white)$/) { + # color + } elsif ($val =~ /^(bold|underline)$/) { + } elsif ($val =~ /^(no-)?(bold|underline|inverse)$/) { + # effect + + } elsif ($val =~ /^(reset|normal)$/) { + # effect also + } else { + #@ Field has invalid color or effect (role: C) + #@ xo_emit("{C:fg-purple,bold}{:foo}{C:gween}", x); + #@ Should be: + #@ xo_emit("{C:fg-red,bold}{:foo}{C:fg-green}", x); + #@ The list of colors and effects are limited. The + #@ set of colors includes default, black, red, green, + #@ yellow, blue, magenta, cyan, and white, which must + #@ be prefixed by either "fg-" or "bg-". Effects are + #@ limited to bold, no-bold, underline, no-underline, + #@ inverse, no-inverse, normal, and reset. Values must + #@ be separated by commas. + error("Field has invalid color or effect (role: C) ($val)"); + } + } + } + } + # A value field if (length($field[0]) == 0 || $field[0] =~ /V/) { @@ -456,7 +499,7 @@ sub check_field { #@ Should be: #@ xo_emit("{D:((}{:good}{D:))}", "yes"); #@ This is minor, but fields should use proper roles. Decoration - #@ fields are meant to hold puncuation and other characters used + #@ fields are meant to hold punctuation and other characters used #@ to decorate the content, typically to make it more readable #@ to human readers. warn("decoration field contains invalid character") |