In [1]:
import pandas as pd

In [3]:
projects = pd.read_csv("projects.tsv", sep="\t", header=0)
projects


Out[3]:
pub_date title excerpt github details_url post_text url_slug note
0 2014-07-10 Soil classification systems Android app to help Geotechnical engineers NaN https://play.google.com/store/apps/details?id=... NaN android-soil-classification NaN
1 2015-08-16 poketpa Android based personal assistant to monitor up... NaN NaN Android based personal assistant to monitor up... poketpa NaN
2 2016-02-02 IITG Study groups Android Application for IIT Guwahati Students ... NaN https://play.google.com/store/apps/details?id=... NaN iitg-study-groups NaN
3 2016-06-06 Bot Dude A Facebook messenger bot written in Python manparvesh/BotDude NaN NaN bot-dude This is not maintained
4 2016-12-24 Super Inventory Manager A system to manage the operations of an invent... manparvesh/SIM NaN NaN sim NaN
5 2016-11-14 Freelancer management system A frontend-only system to manage freelancers f... manparvesh/FMS NaN NaN fms NaN
6 2017-08-10 stlmp Implementation of data structures and algorith... stlmp/stlmp NaN NaN stlmp NaN
7 2018-01-10 Spellor A spell correction library written in Java 8 spellor/spellor NaN NaN spellor NaN
8 2017-10-10 Idea Tracker Plus Enhanced Android app to track projects and ideas IdeaTrackerPlus/IdeaTrackerPlus NaN NaN IdeaTrackerPlus NaN
9 2018-04-10 yoda Personal assistant based on the command line w... yoda-pa/yoda NaN NaN yoda NaN
10 2016-07-06 CONTRADIS Contaminant Transport analysis software NaN https://contradis.github.io/ CONTRADIS is a software package that is built ... contradis NaN

In [4]:
html_escape_table = {
    "&": "&",
    '"': """,
    "'": "'"
    }

def html_escape(text):
    """Produce entities within text."""
    return "".join(html_escape_table.get(c,c) for c in text)

In [7]:
import os
for row, item in projects.iterrows():
    
    md_filename = item.url_slug + ".md"
    html_filename = item.url_slug
    year = item.pub_date[:4]
    
    ## YAML variables
    
    md = "---\ntitle: \""   + item.title + '"\n'
    
    md += """collection: projects"""
    
    md += """\npermalink: /projects/""" + html_filename
    
    if len(str(item.excerpt)) > 5:
        md += "\nexcerpt: '" + html_escape(item.excerpt) + "'"
    
    md += "\ndate: " + str(item.pub_date) 
    
    md += "\n---"
    
    ## Markdown description for individual page
    
    if len(str(item.github)) > 5:
        md += "\n\n<a class=\"btn center\" href=\"https://github.com/" + str(item.github) + "\" target=\"_blank\">View on Github <i class=\"fa fa-external-link\" aria-hidden=\"true\"></i></a>\n" 
        md += "\n{% remotemarkdown https://raw.githubusercontent.com/" + str(item.github) + "/master/README.md %}\n"
    else:
        if len(str(item.note)) > 5:
            md += "\n"
            md += str(item.note)
            md += "{: .notice}"
            md += "\n"
        if len(str(item.post_text)) > 5:
            md += "\n"
            md += str(item.post_text)
            md += "\n"
        if len(str(item.details_url)) > 5:
            md += "\n"
            md += "\n\n<a class=\"btn center\" href=\"" + str(item.details_url) + "\" target=\"_blank\">More details <i class=\"fa fa-external-link\" aria-hidden=\"true\"></i></a>\n" 
            md += "\n"

    md_filename = os.path.basename(md_filename)
       
    with open("../_projects/" + md_filename, 'w') as f:
        f.write(md)