diff --git a/+++/lestyle.css b/+++/lestyle.css index bf4e5a4..e480873 100644 --- a/+++/lestyle.css +++ b/+++/lestyle.css @@ -32,6 +32,15 @@ table td img { .lst ul li { display: inline; } +.lst ul li desc { + bborder: 10px grey ridge; + margin: 2em; + margin-bottom: 1em; + width: 985; + display: block; +} + + .lst ul li img { border: 10px grey ridge; margin: 2em; diff --git a/gen.py b/gen.py index 8098cdb..d847f90 100644 --- a/gen.py +++ b/gen.py @@ -57,34 +57,59 @@ content_map = { '.txt': default }; -def index_content(dir_name, data_dir, index_txt, template): +def index_content(dir_name, data_dir, index_txt, desc_txt, template): + + print " indexing content -- " + dir_name; + + # desc_txt is a markdown file containing description + # for the project - no layout applied to it, only md + if desc_txt: + try: + desc_file = open(desc_txt, 'r+'); + desc_md = markdown.markdown(desc_file.read()); + # transform markdown + except: + print "error opening description file: " + desc_txt; + desc_md = None; + #return; + # index_txt is a json file containing one thing: # an array of files names or glob patterns - print " indexing content -- " + dir_name; + if index_txt: + try: + index_file = open(index_txt, 'r+'); + content_index = json.loads(index_file.read()); + except: + print "error opening index: " + index_txt; + content_index = None; + #return; - try: - index_file = open(index_txt, 'r+'); - content_index = json.loads(index_file.read()); - except: - print "error opening index: " + index_txt; + if desc_md == None and content_index == None: return; - files = []; - for i in content_index: - f = os.path.join(data_dir, i); - if os.path.isfile(f): - files.append(i); - else: - files += [os.path.basename(a) for a in glob.glob(f)]; - content = "" - for j in files: - x, ext = os.path.splitext(j); - element = content_map[ext](j); - if element: - content += "