""" This script transform a md into a plain html in the context of a documentation for Kit&Pack. """ import argparse from lib.geoReader import geoReader print("---------------------------- geo --") print("-- by [email protected] --") print("-----------------------------------") # Parse arguments parser = argparse.ArgumentParser( description='Build the web version of Kit&Pack documentation.') parser.add_argument('-i', dest='doc_in', required=True, help='Input file') parser.add_argument('-o', dest='dir_out', required=True, help='Output directory') args = parser.parse_args() doc_in = args.doc_in dir_out = args.dir_out # Read the document with geoReader(doc_in, dir_out) as g: g.parse()
# Do not explore the .git dir dirs.remove('.git') if dir_in == root: # Skip the root directory continue # Filter files to keep *.md files filesToProcess = [ root + "/" + f for f in files if re.match('.+\.md', f) ] # Process each of them for f in filesToProcess: print('%s' % f) with geoReader(f, dir_out) as g: # Parse the file g.parse() # Save metadata in the index project_id = g.header['long_project_id'] name = g.header['name'] version = g.header['version'] if project_id not in doc_index: doc_index[project_id] = {} doc_index[project_id]["name"] = name versions = doc_index[project_id].get("versions_all", []) doc_index[project_id]["versions_all"] = versions + [version]