Skip to content

Instantly share code, notes, and snippets.

@pmuellr
Created August 10, 2010 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmuellr/518152 to your computer and use it in GitHub Desktop.
Save pmuellr/518152 to your computer and use it in GitHub Desktop.
quick little script to convert a colloquy transcript to HTML, kinda
#!/usr/bin/env python
import os
import sys
#-----------------------------------------------------------------------------
def main():
iFileNames = sys.argv[1:]
for iFileName in iFileNames:
oFileName = os.path.basename(iFileName) + ".html"
iFile = file(iFileName)
iContents = iFile.read()
iFile.close()
oFile = file(oFileName, "w")
oFile.write(css)
oFile.write(iContents)
oFile.close()
print "generated: %s" % (oFileName)
#-----------------------------------------------------------------------------
css = """
<style>
event {
display: none;
}
envelope {
display: block;
border: thin solid black;
background-color: #EEE;
margin: 0.3em;
padding: 0.3em;
-moz-border-radius: 1.0em;
-webkit-border-radius: 1.0em;
}
envelope sender {
border: 0 solid red;
display: block;
font-weight: bold;
color: #F0F;
margin: 0.0em;
padding: 0.2em;
background-color: #DDD;
-moz-border-radius: 1.0em;
-webkit-border-radius: 1.0em;
}
envelope message {
border: 0 solid red;
display: block;
margin: 0.0em;
padding: 0.0em;
padding-left: 1.0em;
}
</style>
"""
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment