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
This commit is contained in:
Yuxuan 'fishy' Wang 2014-09-03 10:06:16 -07:00 committed by Dave Borowitz
parent 4995c3d90e
commit 537664ad70

View File

@ -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,6 +103,7 @@ try:
last_line = ''
elif PAT_SEARCHBOX.match(last_line):
# Case of 'SEARCHBOX\n---------'
if options.searchbox:
out_file.write(SEARCH_BOX)
last_line = ''
elif PAT_INCLUDE.match(line):