From d7bb1337d4a1cab2dc871732960800d67bb982b0 Mon Sep 17 00:00:00 2001 From: caoying03 Date: Thu, 1 Jun 2017 16:40:01 +0800 Subject: [PATCH] add script to convert markdown into html. --- .pre-commit-config.yaml | 8 + .../convert_markdown_into_html.py | 95 ++++ ltr/index.html | 418 ++++++++++++++++++ nmt_without_attention/index.html | 417 +++++++++++++++++ sequence_tagging_for_ner/index.html | 314 +++++++++++++ text_classification/index.html | 302 +++++++++++++ word_embedding/index.html | 227 ++++++++++ 7 files changed, 1781 insertions(+) create mode 100644 .pre-commit-hooks/convert_markdown_into_html.py create mode 100644 ltr/index.html create mode 100644 nmt_without_attention/index.html create mode 100644 sequence_tagging_for_ner/index.html create mode 100644 text_classification/index.html create mode 100644 word_embedding/index.html diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4efc176f..5ed1f4c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,3 +25,11 @@ files: \.md$ - id: remove-tabs files: \.md$ +- repo: local + hooks: + - id: convert-markdown-into-html + name: convert-markdown-into-html + description: Convert README.md into index.html + entry: python .pre-commit-hooks/convert_markdown_into_html.py + language: system + files: .+README\.md$ diff --git a/.pre-commit-hooks/convert_markdown_into_html.py b/.pre-commit-hooks/convert_markdown_into_html.py new file mode 100644 index 00000000..66f44ef2 --- /dev/null +++ b/.pre-commit-hooks/convert_markdown_into_html.py @@ -0,0 +1,95 @@ +import argparse +import re +import sys + +HEAD = """ + + + + + + + + + + + + + + + + +
+
+ + + + + + + +""" + + +def convert_markdown_into_html(argv=None): + parser = argparse.ArgumentParser() + parser.add_argument('filenames', nargs='*', help='Filenames to fix') + args = parser.parse_args(argv) + + retv = 0 + + for filename in args.filenames: + with open( + re.sub(r"README", "index", re.sub(r"\.md$", ".html", filename)), + "w") as output: + output.write(HEAD) + with open(filename) as input: + for line in input: + output.write(line) + output.write(TAIL) + + return retv + + +if __name__ == '__main__': + sys.exit(convert_markdown_into_html()) diff --git a/ltr/index.html b/ltr/index.html new file mode 100644 index 00000000..cce283e3 --- /dev/null +++ b/ltr/index.html @@ -0,0 +1,418 @@ + + + + + + + + + + + + + + + + + +
+
+ + + + + + + diff --git a/nmt_without_attention/index.html b/nmt_without_attention/index.html new file mode 100644 index 00000000..d749ff57 --- /dev/null +++ b/nmt_without_attention/index.html @@ -0,0 +1,417 @@ + + + + + + + + + + + + + + + + + +
+
+ + + + + + + diff --git a/sequence_tagging_for_ner/index.html b/sequence_tagging_for_ner/index.html new file mode 100644 index 00000000..b7c6c899 --- /dev/null +++ b/sequence_tagging_for_ner/index.html @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + +
+
+ + + + + + + diff --git a/text_classification/index.html b/text_classification/index.html new file mode 100644 index 00000000..3ee660d8 --- /dev/null +++ b/text_classification/index.html @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + +
+
+ + + + + + + diff --git a/word_embedding/index.html b/word_embedding/index.html new file mode 100644 index 00000000..83f6809d --- /dev/null +++ b/word_embedding/index.html @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + +
+
+ + + + + + + -- GitLab