From 537664ad704ad36e6a076a871e5cba3177bae3cb Mon Sep 17 00:00:00 2001 From: Yuxuan 'fishy' Wang Date: Wed, 3 Sep 2014 10:06:16 -0700 Subject: [PATCH] Add searchbox option to replace_macros.py. Search boxes in documentation are useful when search feature is available, but it's useless when we host the documentation statically. Add this option so we can generate search-free version of the documentation. Change-Id: I35aadee989ae04b7bbcffd67011634cd0dd085c1 --- Documentation/replace_macros.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/replace_macros.py b/Documentation/replace_macros.py index 7623382728..b159250931 100755 --- a/Documentation/replace_macros.py +++ b/Documentation/replace_macros.py @@ -84,6 +84,10 @@ opts = OptionParser() opts.add_option('-o', '--out', help='output file') opts.add_option('-s', '--src', help='source file') opts.add_option('-x', '--suffix', help='suffix for included filenames') +opts.add_option('-b', '--searchbox', action="store_true", default=True, + help="generate the search boxes") +opts.add_option('--no-searchbox', action="store_false", dest='searchbox', + help="don't generate the search boxes") options, _ = opts.parse_args() try: @@ -99,7 +103,8 @@ try: last_line = '' elif PAT_SEARCHBOX.match(last_line): # Case of 'SEARCHBOX\n---------' - out_file.write(SEARCH_BOX) + if options.searchbox: + out_file.write(SEARCH_BOX) last_line = '' elif PAT_INCLUDE.match(line): # Case of 'include::'