parameters: (self)
docstring: Creates sitemap for each category page.
docstring_summary: Creates sitemap for each category page.
docstring_tokens: Creates sitemap for each category page .
function: def generate_categories_sitemap(self):
          """
          Creates sitemap for each category page.
          """
          toc = library.get_toc()
          def cat_paths(toc):
              paths = []
              for t in toc:
                  cat = t.get("category", None)
                  if cat:
                      cat = cat.replace(" ", "%20")
                      paths.append(cat)
                      try:
                          subpaths = cat_paths(t["contents"])
                      except KeyError:
                          continue
                      paths = paths + [cat + "/" + sp for sp in subpaths]
              return paths
          paths = cat_paths(toc)
          urls = [self._hostname + "/texts/" + p for p in paths]
          self.write_urls(urls, "categories-sitemap.xml")
function_tokens: def generate_categories_sitemap ( self ) : toc = library . get_toc ( ) def cat_paths ( toc ) : paths = [ ] for t in toc : cat = t . get ( "category" , None ) if cat : cat = cat . replace ( " " , "%20" ) paths . append ( cat ) try : subpaths = cat_paths ( t [ "contents" ] ) except KeyError : continue paths = paths + [ cat + "/" + sp for sp in subpaths ] return paths paths = cat_paths ( toc ) urls = [ self . _hostname + "/texts/" + p for p in paths ] self . write_urls ( urls , "categories-sitemap.xml" )