start using a table

pull/977/head
Ben Parsons 7 years ago
parent e18aa30fd2
commit 1f7fbefd53

@ -7,6 +7,7 @@
import requests
import re
from datetime import datetime
from m2r import convert as m2r
def getpage(url, page):
@ -18,32 +19,57 @@ def getpage(url, page):
return re.search('page=(.+?)', link['url']).group(1)
json = list()
print("json:" + str(len(json)))
# labels = ['p1', p2]
# new status labels:
# proposal-ready-for-review,rejected,stalled,merged,spec-pr-in-review,proposal-wip,proposal-in-review,spec-pr-ready-for-review,proposal-passed-review
urlbase = 'https://api.github.com/repos/matrix-org/matrix-doc/issues?labels=p1,p2,p3,p4,p5&state=open&page='
pagecount = getpage('https://api.github.com/repos/matrix-org/matrix-doc/issues?labels=spec-omission&state=open&page=', 1)
print("json:" + str(len(json)))
print("pagecount:" + str(pagecount))
for page in range(2, int(pagecount) + 1):
getpage('https://api.github.com/repos/matrix-org/matrix-doc/issues?labels=spec-omission&state=open&page=', page)
print("json:" + str(len(json)))
print("currentpage:" + str(page))
print("pagecount:" + str(pagecount))
print("json:" + str(len(json)))
getpage(urlbase, page)
text_file = open("../specification/proposals.rst", "w")
text_file.write(".. contents:: Table of Contents\n")
text_file.write(".. sectnum::")
text_file.write("\n")
text_file.write("Tables\n------------------\n\n.. list-table::\n :header-rows: 1\n\n")
text_file.write(" * - ID\n")
text_file.write(" - github username\n")
text_file.write(" - proposal title\n")
text_file.write(" - created_at\n")
text_file.write(" - updated_at\n")
text_file.write(" - maindoc\n")
#`matrix-doc/issues <https://github.com/matrix-org/matrix-doc/issues?page=1&q=is%3Aissue+is%3Aopen>`_
for item in json:
maindoc = re.search('Documentation: (.+?)\n', str(item['body']))
if maindoc is not None:
maindoc = maindoc.group(1)
text_file.write(" * - `" + str(item['number']) + " <" + item['html_url'] + ">`_\n")
text_file.write(" - " + item['user']['login'] + "\n")
text_file.write(" - " + item['title'] + "\n")
text_file.write(" - " + item['created_at'] + "\n")
text_file.write(" - " + item['updated_at'] + "\n")
text_file.write(" - " + str(maindoc) + "\n")
text_file.write("\n")
text_file.write("The Proposals List\n------------------\n")
# text_file.write(json[0]['user']['login'])
for item in json:
# write a header
prop_header = item['title'] + " (" + str(item['number']) + ")"
text_file.write(prop_header + "\n")
text_file.write("~" * len(prop_header))
text_file.write("\n\n")
# write some metadata
text_file.write(item['created_at'] + "\n")
text_file.write(item['updated_at'] + "\n")
# created = datetime.strptime(item['created_at'], "%Y-%m-%dT%XZ")
# write body text
body = m2r(str(item['body']))
text_file.write(body + "\n\n\n")

Loading…
Cancel
Save