aboutsummaryrefslogtreecommitdiff
path: root/converter.py
blob: 6d8ae8d03c9b1fd4df2612d38e2091c38aa96c05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3

from optparse import OptionParser
from re import search, sub

"""Command line arguments"""
usage = "usage: %prog [options] file..."
parser = OptionParser(usage=usage)
parser.add_option('-i', '--initial-html', dest='header',
                  help='File for initial template of compiled HTML',
                  default='initial.html')
parser.add_option('-o', '--output-type', dest='output_type',
                  help='Type of output (filename | date)',
                  default='filename')
(options, args) = parser.parse_args()


"""Valid argument testing
TODO: Add support for directories
"""
markdown_files = []
for file in args:
    if search(".md", file) is not None:
        # Is a markdown file
        markdown_files.append(file)
    else:
        print(file, "is not a markdown file, skipping")


"""Read header"""
header = []
with open(options.header, 'r') as file:
    header = file.readlines()