1 """Simple script to replace @DATE@ and friends with real information.
3 Usage: rewrite.py boilerplate.tex [VAR=value] ... <template >output
15 start
= string
.find(s
, r
"\date{")
17 end
= string
.find(s
, "}", start
)
20 date
= time
.strftime("%B %d, %Y", time
.localtime(time
.time()))
28 # yes, we actully need to load the replacement values
29 d
= get_info(open(sys
.argv
[1]))
30 for arg
in sys
.argv
[2:]:
31 name
, value
= string
.split(arg
, "=", 1)
35 start
= string
.find(s
, "@", start
)
38 end
= string
.find(s
, "@", start
+1)
45 s
= s
[:start
] + value
+ s
[end
+1:]
46 start
= start
+ len(value
)
49 s
= s
[:start
] + s
[end
:]
54 if __name__
== "__main__":