Skip to content

Commit

Permalink
Add README.md.in
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed May 20, 2017
1 parent 10ee9c1 commit 407a5b1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
7 changes: 7 additions & 0 deletions README.md.in
@@ -0,0 +1,7 @@
# PyTorch for Numpy users.

[![Build Status](https://travis-ci.com/wkentaro/pytorch-for-numpy-users.svg?token=zM5rExyvuRoJThsnqHAF&branch=master)](https://travis-ci.com/wkentaro/pytorch-for-numpy-users)

[PyTorch](https://github.com/pytorch/pytorch.git) version of [_Torch for Numpy users_](https://github.com/torch/torch7/wiki/Torch-for-Numpy-users).

$contents
28 changes: 13 additions & 15 deletions generate_readme.py
Expand Up @@ -2,25 +2,12 @@

import collections
import os.path as osp
import string

import tabulate
import yaml


TEMPLATE = '''\
# PyTorch for Numpy users.
[![Build Status](https://travis-ci.com/wkentaro/pytorch-for-numpy-users.svg?token=zM5rExyvuRoJThsnqHAF&branch=master)](https://travis-ci.com/wkentaro/pytorch-for-numpy-users)
[PyTorch](https://github.com/pytorch/pytorch.git) version of [_Torch for Numpy users_](https://github.com/torch/torch7/wiki/Torch-for-Numpy-users).
{contents}
'''


here = osp.dirname(osp.abspath(__file__))


def get_section(title, data, h=2):
if not isinstance(data, list):
content = '%s %s\n\n' % ('#' * h, title.capitalize())
Expand Down Expand Up @@ -56,4 +43,15 @@ def get_contents():
return '\n'.join(contents)


print(TEMPLATE.format(contents=get_contents()))
here = osp.dirname(osp.abspath(__file__))


def main():
template = open(osp.join(here, 'README.md.in')).read()
template = string.Template(template)
readme = template.substitute(contents=get_contents())
print(readme)


if __name__ == '__main__':
main()

0 comments on commit 407a5b1

Please sign in to comment.