#! /usr/bin/env python3 #=============================== # # chatlog # # 2019/12/23 Kuninori Morimoto #=============================== import sys import os import re import glob import base #==================================== # # log # #==================================== class log(base.base): #-------------------- # show #-------------------- def show(self): print("h1. Chat Log\n") print("") current="" year="" dir = "wiki/Chat_log" tr = 0 files = glob.glob("{}/{}/*-chatlog".format(self.top(), dir)) files.sort(reverse=True) for file in files: name = os.path.basename(file) date = re.sub(r'(\d+)-\w*-.*', r'\1', name) y = date[0:4] if (year != y): if (year != ""): print("\n", end="") if (tr % 6 == 0): if (year != ""): print("") print("") print("
\n") year = y tr += 1 print("h2. {}\n".format(year)) print("|_. date|_. core|_. io|_. mm|") if (date != current): current = date print("|{}-{}-{}".format(year, date[4:6], date[6:8]), end="") for grp in ["core", "io", "mm"]: print("|%s" %("\"{}\":../../{}/{}-{}-chatlog".format(grp, dir, date, grp) if "{}/{}/{}-{}-chatlog".format(self.top(), dir, date, grp) in files else ""), end="") print("|") print("\n
") #==================================== # # As command # #==================================== if __name__=='__main__': log().show()