[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Sun Jun 14 04:25:46 UTC 2020


The branch, master has been updated
       via  9ba6ce1b More release improvements.
       via  ca9e2477 Mention renamed .md files.
      from  f27a630e Don't use c++ comments.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9ba6ce1b67bd6d617c7fb59924a1a4c3c4c79069
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 13 21:10:13 2020 -0700

    More release improvements.

commit ca9e2477627ac5b9c6b6f52a03eb00d277305efb
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sat Jun 13 20:42:33 2020 -0700

    Mention renamed .md files.

-----------------------------------------------------------------------

Summary of changes:
 NEWS.md                 |  3 ++
 packaging/md2html       | 87 +++++++++++++++++++++++++++++++++++++++++++++++++
 packaging/release-rsync | 17 ++++++----
 3 files changed, 101 insertions(+), 6 deletions(-)
 create mode 100755 packaging/md2html


Changeset truncated at 500 lines:

diff --git a/NEWS.md b/NEWS.md
index 18a28545..95fe78b6 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -143,6 +143,9 @@ Protocol: 31 (unchanged)
 
  - Add installed man page: /usr/man/man1/rsync-ssl.1
 
+ - Some "readme" files have changed names to be .md files, such as: README.md,
+   INSTALL.md, NEWS.md, & OLDNEWS.md.
+
  - The rsync-ssl script wants to run either openssl or stunnel4, so consider
    adding a dependency for openssl (though it's probably fine to just let it
    complain about being unable to find either program and let the user decide
diff --git a/packaging/md2html b/packaging/md2html
new file mode 100755
index 00000000..f0f61cdc
--- /dev/null
+++ b/packaging/md2html
@@ -0,0 +1,87 @@
+#!/usr/bin/python3
+
+# Copyright (C) 2020 Wayne Davison
+#
+# This program is freely redistributable.
+
+import re, argparse
+
+HTML_START = """\
+<html><head>
+<title>%s</title>
+<link href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Mono&display=swap" rel="stylesheet">
+<style>
+body {
+  max-width: 50em;
+  margin: auto;
+}
+body, b, strong, u {
+  font-family: 'Roboto', sans-serif;
+}
+code {
+  font-family: 'Roboto Mono', monospace;
+  font-weight: bold;
+}
+pre code {
+  display: block;
+  font-weight: normal;
+}
+blockquote pre code {
+  background: #f1f1f1;
+}
+dd p:first-of-type {
+  margin-block-start: 0em;
+}
+</style>
+</head><body>
+"""
+
+HTML_END = """\
+</body></html>
+"""
+
+md_parser = None
+
+def main():
+    for mdfn in args.mdfiles:
+        title = re.sub(r'.*/', '', mdfn).replace('.md', '')
+        htfn = mdfn.replace('.md', '.html')
+
+        print("Parsing", mdfn, '->', htfn)
+
+        with open(mdfn, 'r', encoding='utf-8') as fh:
+            txt = fh.read()
+
+        html = md_parser(txt)
+
+        with open(htfn, 'w', encoding='utf-8') as fh:
+            fh.write(HTML_START % title)
+            fh.write(html)
+            fh.write(HTML_END)
+
+
+def html_via_cmarkgfm(txt):
+    return cmarkgfm.markdown_to_html(txt)
+
+
+def html_via_commonmark(txt):
+    return commonmark.HtmlRenderer().render(commonmark.Parser().parse(txt))
+
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='Output html for md pages.', add_help=False)
+    parser.add_argument("--help", "-h", action="help", help="Output this help message and exit.")
+    parser.add_argument("mdfiles", nargs='+', help="The .md files to turn into .html files.")
+    args = parser.parse_args()
+
+    try:
+        import cmarkgfm
+        md_parser = html_via_cmarkgfm
+    except:
+        try:
+            import commonmark
+            md_parser = html_via_commonmark
+        except:
+            die("Failed to find cmarkgfm or commonmark for python3.")
+
+    main()
diff --git a/packaging/release-rsync b/packaging/release-rsync
index ee771bd0..a4c193c6 100755
--- a/packaging/release-rsync
+++ b/packaging/release-rsync
@@ -329,13 +329,18 @@ About to:
     shutil.rmtree(rsync_ver)
 
     print(f"Updating the other files in {dest} ...")
-    cmd_chk('rsync -a README.md NEWS.md OLDNEWS.md TODO'.split() + [dest])
-    if os.path.lexists(news_file):
-        os.unlink(news_file)
-    os.link(f"{dest}/NEWS.md", news_file)
-    cmd_chk(f"git log --name-status | gzip -9 >{dest}/ChangeLog.gz")
+    md_files = 'README.md NEWS.md OLDNEWS.md'.split()
+    html_files = [ fn for fn in gen_files if fn.endswith('.html') ]
+    cmd_chk(['rsync', '-a', *md_files, *html_files, dest])
+    cmd_chk(["packaging/md2html"] + [ dest +'/'+ fn for fn in md_files ])
+
+    for topfn, verfn in (('NEWS.md', news_file), ('NEWS.html', news_file.replace('.md', '.html'))):
+        topfn = dest + '/' + topfn
+        if os.path.lexists(verfn):
+            os.unlink(verfn)
+        os.link(topfn, verfn)
 
-    cmd_chk(['rsync', '-a', *glob.glob('*.[1-9].html'), os.path.join(dest, html_fn)])
+    cmd_chk(f"git log --name-status | gzip -9 >{dest}/ChangeLog.gz")
 
     for fn in (srctar_file, pattar_file, diff_file):
         asc_fn = fn + '.asc'


-- 
The rsync repository.



More information about the rsync-cvs mailing list