[PATCH v2 1/1] syntax-highlight: when the file has no extension, assume text

Ferry Huberts mailings at hupie.com
Wed Apr 4 19:07:18 CEST 2012



On 04-04-12 18:58, Lukas Fleischer wrote:
> On Wed, Apr 04, 2012 at 06:15:02PM +0200, Ferry Huberts wrote:
>> From: Ferry Huberts<ferry.huberts at pelagic.nl>
>>
>> There are 2 situations:
>> 1- empty extension: assuming text is better than highlight
>>     producing no output because of a missing argument.
>> 2- no extension at all: assuming text is better than setting
>>     the extension to the filename, which is what now happens.
>>
>> Signed-off-by: Ferry Huberts<ferry.huberts at pelagic.nl>
>> ---
>>   filters/syntax-highlighting.sh |    3 +++
>>   1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh
>> index 5fcc9c9..8b09180 100755
>> --- a/filters/syntax-highlighting.sh
>> +++ b/filters/syntax-highlighting.sh
>> @@ -39,6 +39,9 @@
>>   BASENAME="$1"
>>   EXTENSION="${BASENAME##*.}"
>>
>> +[ "${BASENAME}" == "${EXTENSION}" ]&&  EXTENSION=txt
>
> There is no "==" in POSIX shell/test(1). This should probably be a
> single equal sign ("=").
>
>> +[ -z "${EXTENSION}" ]&&  EXTENSION=txt
>> +
>>   # map Makefile and Makefile.* to .mk
>>   [ "${BASENAME%%.*}" == "Makefile" ]&&  EXTENSION=mk
>>

it appears there is, or (if there is not) the line above also doesn't 
work (that line has been in since 56522eb, 19-11-2009)



-- 
Ferry Huberts




More information about the CGit mailing list