# #noprianto.com website content generator #(c) Noprianto , 2017 #GPL import time DATE_FORMAT = '%Y-%m-%d %H:%M:%S %z' NOW = time.strftime(DATE_FORMAT) LABEL = '[[LABEL]]' MENU = '[[MENU]]' CONTENT = '[[CONTENT]]' UPDATE = '[[UPDATE]]' TEMPLATE = ''' Personal website of Noprianto - %s
noprianto.com
%s
%s
''' %(LABEL, MENU, CONTENT, UPDATE) PAGES = ( ('index', 'Home', """
Hello. My name is Noprianto. Welcome to my website.

I enjoy programming. Currently, i am working as a computer programmer at a small software company, and studying computer science at Bina Nusantara University, Jakarta, Indonesia.

I am passionate about programming languages, backward and forward compatibility, reliable software, and street foods.

Email address: nop@noprianto.com
""" ), ('book', 'Printed Books', """

Python & Pemrograman Linux (ISBN 979-533-887-0)

In Bahasa Indonesia, published in 2002 by Penerbit Andi Yogyakarta


Panduan Praktis Debian GNU/Linux 3.1 (ISBN 979-523-788-8)

In Bahasa Indonesia, published in 2006 by Penerbit Dian Rakyat


OpenOffice.org 2.0 (ISBN 979-523-738-1)

In Bahasa Indonesia, published in 2006 by Penerbit Dian Rakyat

""" ), ('ebook', 'Free E-Books', """ """ ), ('paper', 'Papers', """

Accepted papers

Codes used in papers

2017 International Conference


2016 International Conference

""" ), ('software', 'Software', """

Free/Open Source Software

Hosted at github.com/nopri """ ), ('lecturer', 'Guest Lecturer', """

2017


2016

""" ) ) def generate_menu(menu): ret = ''' ''' for i in PAGES: ret += ''' ''' name = i[0] label = i[1] if (name == menu): item = '%s' %(label) else: item = label ret += ''' %s''' %(name, item) ret += ''' ''' ret += ''' ''' return ret def generate_page(page): ret = '' for i in PAGES: name = i[0] if name == page: label = i[1] menu = generate_menu(page) content = i[2] ret = TEMPLATE.replace(LABEL, label).replace(MENU, menu).replace(CONTENT, content).replace(UPDATE, NOW) return ret def main(): for i in PAGES: name = i[0] file_name = '%s.html' %(name) page = generate_page(name) open(file_name, 'w').write(page) if __name__ == '__main__': main()