From 1fed20cba7b7fee45f2f72e1486c3bcd04c74017 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Fri, 17 May 2013 11:13:53 +0200 Subject: [PATCH] Expect formatted json as input, blue numbers This patch avoid coloring what's inside item's strings, but expect a formatted input. --- colout/colout_json.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/colout/colout_json.py b/colout/colout_json.py index 4784a74..5eaefeb 100644 --- a/colout/colout_json.py +++ b/colout/colout_json.py @@ -1,8 +1,12 @@ def theme(): + # This theme expect a formatted JSON input, with items spread across lines. + # See tools like "python -m json.tool" or "json_xs" return [ - [ '[][{}]' ], - [ '[:,]', "yellow" ], + [ '[\[\]{}],*\s*\n' ], + [ '" (:) ', "yellow" ], + [ '[\]}"](,)', "yellow" ], + [ "\"(-*[0-9]+\.*[0-9]*e*-*[0-9]*)\"", "blue" ], [ '"(.*)"', "green" ], [ """["']""", "cyan" ] ]