From 407a5b11cee0231f0b7377c9c904db1b7d0b8ff9 Mon Sep 17 00:00:00 2001 From: Kentaro Wada Date: Sun, 21 May 2017 06:58:28 +0900 Subject: [PATCH] Add README.md.in --- README.md.in | 7 +++++++ generate_readme.py | 28 +++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 README.md.in diff --git a/README.md.in b/README.md.in new file mode 100644 index 0000000..964cfd9 --- /dev/null +++ b/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 diff --git a/generate_readme.py b/generate_readme.py index 708ce83..63e858c 100755 --- a/generate_readme.py +++ b/generate_readme.py @@ -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()) @@ -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()