@@ -81,7 +81,8 @@ def sub(pattern, repl, string, **kwargs):
8181 ([^{}\n\r]*)
8282 """ % pattern
8383
84- repl = re .sub (r"\\(\d)" , lambda m : r"\%d" % (int (m .group (1 )) + 2 ), repl )
84+ repl = re .sub (r"\\(\d)" ,
85+ lambda m : r"\%d" % (int (m .group (1 )) + 2 ), repl )
8586
8687 return re .sub (pattern , r"\1\2%s\%d" % (repl , num_groups + 3 ), string ,
8788 flags = flags , ** kwargs )
@@ -128,15 +129,15 @@ def html(lines, contact_lines, *args):
128129
129130 gravatar = None
130131 for line in contact_lines :
131- if line . find ( "@" ) > 0 :
132+ if '@' in line and '--no-gravatar' not in args :
132133 gravatar = GRAVATAR .format (
133134 hash = hashlib .md5 (line .lower ().strip ('<>' )).hexdigest ())
134135 break
135136 if gravatar is not None :
136137 contact_lines .insert (0 , "<img src='{}' />" .format (gravatar ))
137138
138139 lines .insert (0 , "<div id='container'><div id='contact'>%s</div>\n " %
139- ("<p>" + "</p><p>" .join (contact_lines ) + "</p>" ))
140+ ("<p>" + "</p><p>" .join (contact_lines ) + "</p>" ))
140141 lines .insert (1 , "<div>" )
141142 lines .append ("</div>" )
142143
@@ -149,6 +150,11 @@ def main():
149150 except IndexError :
150151 raise Exception ("No format specified" )
151152
153+ if '-h' in sys .argv or '--help' in sys .argv :
154+ sys .stderr .write (
155+ "Usage: python resume.py tex|html [--no-gravatar] < INPUT.md\n " )
156+ raise SystemExit
157+
152158 lines = sys .stdin .readlines ()
153159
154160 contact_lines = []
0 commit comments