[docs] faster local/debug build (#10840)

This commit is contained in:
Ivan Blinkov 2020-05-12 17:09:36 +03:00 committed by GitHub
parent ff0ae624ef
commit 8771402cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -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)

View File

@ -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)