parameters: (self)
docstring: Build the JSON file containing the index data for 'search' option.
  
          The 'search' option is used by internal apps that require a search.
docstring_summary: Build the JSON file containing the index data for 'search' option.
docstring_tokens: Build the JSON file containing the index data for search option .
function: def postExecute(self):
          """Build the JSON file containing the index data for 'search' option.
  
          The 'search' option is used by internal apps that require a search.
          """
          dest = self.translator.get('destination')
          iname = os.path.join(dest, 'js', 'search_index.js')
          items = []
  
          # TODO: Remove the ability to use a URL for 'home'
          home_param = self.get('home')
          home = self.translator.findPage(home_param.lstrip('/'),
                                          exact=home_param.startswith('/'),
                                          throw_on_zero=False)
          if home is None:
              LOG.warning("The use of a URL in the 'home' option is deprecated. By default the home " \
                          "page is set to '/index.md', which is the 'index.md' at the root content " \
                          "directory of the website. If this is correct for your website then " \
                          "remove this option from the config.yml, otherwise set the value to " \
                          "the desired markdown page, use a leading '/' for exact match.")
              home = self.get('home')
  
          for page in self.translator.getPages():
              if isinstance(home, pages.Page):
                  location = home.relativeDestination(page)
              else:
                  location = page.destination.replace(dest, home)
  
              for data in page.get('search', list()):
                  url = '{}#{}'.format(location, data['bookmark'])
                  items.append(dict(title=data['title'], text=data['text'], location=url))
  
          if not os.path.isdir(os.path.dirname(iname)):
              os.makedirs(os.path.dirname(iname))
          write(iname, 'var index_data = {};'.format(json.dumps(items)))
function_tokens: def postExecute ( self ) : dest = self . translator . get ( 'destination' ) iname = os . path . join ( dest , 'js' , 'search_index.js' ) items = [ ] # TODO: Remove the ability to use a URL for 'home' home_param = self . get ( 'home' ) home = self . translator . findPage ( home_param . lstrip ( '/' ) , exact = home_param . startswith ( '/' ) , throw_on_zero = False ) if home is None : LOG . warning ( "The use of a URL in the 'home' option is deprecated. By default the home " "page is set to '/index.md', which is the 'index.md' at the root content " "directory of the website. If this is correct for your website then " "remove this option from the config.yml, otherwise set the value to " "the desired markdown page, use a leading '/' for exact match." ) home = self . get ( 'home' ) for page in self . translator . getPages ( ) : if isinstance ( home , pages . Page ) : location = home . relativeDestination ( page ) else : location = page . destination . replace ( dest , home ) for data in page . get ( 'search' , list ( ) ) : url = '{}#{}' . format ( location , data [ 'bookmark' ] ) items . append ( dict ( title = data [ 'title' ] , text = data [ 'text' ] , location = url ) ) if not os . path . isdir ( os . path . dirname ( iname ) ) : os . makedirs ( os . path . dirname ( iname ) ) write ( iname , 'var index_data = {};' . format ( json . dumps ( items ) ) )