#!/usr/bin/python """ Make single page versions of the documentation for release and conversion into man pages etc. """ import os import re from datetime import datetime docpath = "docs/content" outfile = "MANUAL.md" # Order to add docs segments to make outfile docs = [ "about.md", "install.md", "docs.md", "remote_setup.md", "filtering.md", "overview.md", "drive.md", "s3.md", "swift.md", "dropbox.md", "googlecloudstorage.md", "amazonclouddrive.md", "onedrive.md", "hubic.md", "b2.md", "yandex.md", "sftp.md", "ftp.md", "http.md", "crypt.md", "local.md", "changelog.md", "bugs.md", "faq.md", "licence.md", "authors.md", "contact.md", ] # Order to put the commands in - any not on here will be in sorted order commands_order = [ "rclone_config.md", "rclone_copy.md", "rclone_sync.md", "rclone_move.md", "rclone_delete.md", "rclone_purge.md", "rclone_mkdir.md", "rclone_rmdir.md", "rclone_check.md", "rclone_ls.md", "rclone_lsd.md", "rclone_lsl.md", "rclone_md5sum.md", "rclone_sha1sum.md", "rclone_size.md", "rclone_version.md", "rclone_cleanup.md", "rclone_dedupe.md", ] # Docs which aren't made into outfile ignore_docs = [ "downloads.md", "privacy.md", "donate.md", ] def read_doc(doc): """Read file as a string""" path = os.path.join(docpath, doc) with open(path) as fd: contents = fd.read() parts = contents.split("---\n", 2) if len(parts) != 3: raise ValueError("Couldn't find --- markers: found %d parts" % len(parts)) contents = parts[2].strip()+"\n\n" # Remove icons contents = re.sub(r'