From 8771402cb5bfb36381e8a020a9ba1b9198dd1541 Mon Sep 17 00:00:00 2001 From: Ivan Blinkov Date: Tue, 12 May 2020 17:09:36 +0300 Subject: [PATCH] [docs] faster local/debug build (#10840) --- docs/tools/build.py | 4 ++++ docs/tools/mdx_clickhouse.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/docs/tools/build.py b/docs/tools/build.py index 05f611a9a30..406f5689bc4 100755 --- a/docs/tools/build.py +++ b/docs/tools/build.py @@ -241,6 +241,7 @@ if __name__ == '__main__': arg_parser.add_argument('--skip-amp', action='store_true') arg_parser.add_argument('--skip-pdf', action='store_true') arg_parser.add_argument('--skip-website', action='store_true') + arg_parser.add_argument('--skip-git-log', action='store_true') arg_parser.add_argument('--test-only', action='store_true') arg_parser.add_argument('--minify', action='store_true') arg_parser.add_argument('--htmlproofer', action='store_true') @@ -273,6 +274,9 @@ if __name__ == '__main__': args.skip_pdf = True args.skip_amp = True + if args.skip_git_log or args.skip_amp: + mdx_clickhouse.PatchedMacrosPlugin.skip_git_log = True + from build import build build(args) diff --git a/docs/tools/mdx_clickhouse.py b/docs/tools/mdx_clickhouse.py index 3afd1bb76ac..6e41c7d07bb 100755 --- a/docs/tools/mdx_clickhouse.py +++ b/docs/tools/mdx_clickhouse.py @@ -86,6 +86,7 @@ def get_translations(dirname, lang): class PatchedMacrosPlugin(macros.plugin.MacrosPlugin): disabled = False + skip_git_log = False def on_config(self, config): super(PatchedMacrosPlugin, self).on_config(config) @@ -120,6 +121,8 @@ class PatchedMacrosPlugin(macros.plugin.MacrosPlugin): markdown = super(PatchedMacrosPlugin, self).on_page_markdown(markdown, page, config, files) if config.data['extra'].get('version_prefix') or config.data['extra'].get('single_page'): return markdown + if self.skip_git_log: + return markdown src_path = page.file.abs_src_path try: git_log = subprocess.check_output(f'git log --follow --date=iso8601 "{src_path}"', shell=True)