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:
parent
4995c3d90e
commit
537664ad70
@ -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::<filename>'
|
||||
|
Loading…
Reference in New Issue
Block a user