def get_page_context(page, content, toc, meta, config):
 if config[u'site_url']:
  page.set_canonical_url(config[u'site_url'])
 if config[u'repo_url']:
  page.set_edit_url(config[u'repo_url'], config[u'edit_uri'])
 page.content = content
 page.toc = toc
 page.meta = meta
 if (page.is_homepage or (page.title is None)):
  page_title = None
 else:
  page_title = page.title
 if page.is_homepage:
  page_description = config[u'site_description']
 else:
  page_description = None
 return {u'page': page, u'page_title': page_title, u'page_description': page_description, u'content': content, u'toc': toc, u'meta': meta, u'canonical_url': page.canonical_url, u'current_page': page, u'previous_page': page.previous_page, u'next_page': page.next_page}

def get_page_context ( page , content , toc , meta , config ) : if config [ u'site_url' ] : page . set_canonical_url ( config [ u'site_url' ] ) if config [ u'repo_url' ] : page . set_edit_url ( config [ u'repo_url' ] , config [ u'edit_uri' ] ) page . content = content page . toc = toc page . meta = meta if ( page . is_homepage or ( page . title is None ) ) : page_title = None else : page_title = page . title if page . is_homepage : page_description = config [ u'site_description' ] else : page_description = None return { u'page' : page , u'page_title' : page_title , u'page_description' : page_description , u'content' : content , u'toc' : toc , u'meta' : meta , u'canonical_url' : page . canonical_url , u'current_page' : page , u'previous_page' : page . previous_page , u'next_page' : page . next_page }
generate the page context by extending the global context and adding page specific variables .