Instantly share code, notes, and snippets.

What would you like to do?
Modifications needed to be done on html generated by pandoc for blogger
import sys
import os
import fileinput
# alias modifications="python ~/Desktop/30DaysOfBlogging/"
# Run the script with `modifications <markdown file>`
def modify(html_file):
# If file doesnot exist, just exit
if not os.path.exists(html_file):
print("ERROR: HTML file '" + html_file + "' does not exist. Exiting")
full_file = open(html_file).read()
modified_file = full_file.replace('<pre><code>', '<pre class="prettyprint">').replace('</code></pre>', '</pre>')
with open(html_file, 'w') as file:
if __name__ == '__main__':
# One argument, which is the name of the html file
if len(sys.argv) is not 2:
print("ERROR: One and only one argument needed. Html file")
html_file = sys.argv[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment