Compare commits

..

No commits in common. "4395dea1fd53b07cc2d520dc9236bf2e2f5a611c" and "b2509a3c48ee246e64ab45bc5db1397e3b4d1e78" have entirely different histories.

3 changed files with 61 additions and 73 deletions

View File

@ -22,7 +22,6 @@ import os
import re
import shutil
input_directory = 'content'
static_directory = 'static'
output_directory = 'output'
@ -33,9 +32,11 @@ md_extensions = ['fenced_code', 'codehilite', 'nl2br', 'toc', 'smarty', 'tables'
def print_file(in_file, out_file):
print('%-62s -> %s' % (in_file, out_file))
template = open('template.html').read()
def copy_static_files():
for (dirpath, _, filenames) in os.walk(static_directory):
os.makedirs(output_directory, exist_ok=True)
for (dirpath, _, filenames) in os.walk(static_directory):
for filename in filenames:
source = os.path.join(dirpath, filename)
out_path = dirpath.replace(static_directory, '', 1)
@ -47,9 +48,7 @@ def copy_static_files():
shutil.copy2(source, dest)
def process_markdown_files():
template = open('template.html').read()
for (dirpath, _, filenames) in os.walk(input_directory):
for (dirpath, _, filenames) in os.walk(input_directory):
for filename in filenames:
markdown_filename = os.path.join(dirpath, filename)
if not markdown_filename.endswith('.md'):
@ -91,28 +90,10 @@ def process_markdown_files():
out_file.write(output)
out_file.close()
def make_sitemap():
sitemap_command = ' '.join("""
find output -regextype posix-extended -regex '.*.(html|pdf)$' |
grep -v ^output/google |
grep -v ^output/drafts |
perl -pe 's|output|https://www.mcmillen.dev|'
> output/sitemap.txt""".split('\n'))
os.system(sitemap_command)
def make_rss(): # TODO: implement.
pass
def main():
os.makedirs(output_directory, exist_ok=True)
copy_static_files()
process_markdown_files()
make_sitemap()
make_rss()
if __name__ == '__main__':
main()
# TODO: make a sitemap / RSS?
#index_filename = os.path.join(output_directory, 'index.html')
#print_file('', index_filename)
#index = open(index_filename, 'w')
#for f in out_filenames:
# index.write('<a href="%s">%s</a><br>' % (f, f))
#index.close()

7
static/sitemap.txt Normal file
View File

@ -0,0 +1,7 @@
https://www.mcmillen.dev
https://www.mcmillen.dev/language_checklist.html
https://www.mcmillen.dev/publications.html
https://www.mcmillen.dev/resume.html
https://www.mcmillen.dev/sigbovik/
https://www.mcmillen.dev/sigbovik/2019.pdf
https://www.mcmillen.dev/sigbovik/splatters.html