X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=geekigeeki.py;h=470752de0d44076f31272693a206bf0a1ed9cdc2;hb=0a5c27be02429f5fb00be79c4e11b70666713530;hp=4d50a3af5c0fd4aa29c24ec1918e59f801a2d047;hpb=41e94725555d64df1b6e56ffd29a733c28e0bfdf;p=geekigeeki.git diff --git a/geekigeeki.py b/geekigeeki.py index 4d50a3a..470752d 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -79,7 +79,7 @@ def permalink(s): return re.sub(' ', '-', re.sub('[^a-z0-9_ ]', '', s.lower()).strip()) def humanlink(s): - return re.search('([^:/\.]+)(?:\.[^/:]+|)$', s).group(1).replace('_', ' ') + return re.sub(r'([^:/\.]+)(?:\.[^/:]+|)$', r'\1', s.replace('_', ' ')) # Split arg lists like "blah| blah blah| width=100 | align = center", # return a list containing anonymous arguments and a map containing the named arguments @@ -87,10 +87,10 @@ def parse_args(s): args = [] kwargs = {} for arg in s.strip('<[{}]>').split('|'): - try: - key, val = arg.split('=', 1) - kwargs[key.strip()] = val.strip() - except ValueError: + m = re.match('\s*(\w+)\s*=\s*(.+)\s*', arg) + if m is not None: + kwargs[m.group(1)] = m.group(2) + else: args.append(arg.strip()) return (args, kwargs) @@ -161,24 +161,24 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal # Navbar print('