From 95908ad8ba3dc628af773e111017d675ca474ab4 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Thu, 13 Jan 2011 12:22:22 +0100 Subject: [PATCH] plugins/hierarchy: remove show_orphan_files --- in/functions.md | 9 +++------ plugins/hierarchy.py | 38 ++------------------------------------ 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/in/functions.md b/in/functions.md index a87bce8..5b28338 100644 --- a/in/functions.md +++ b/in/functions.md @@ -2,8 +2,8 @@ title: Functions parent: Webber lang: en ctime: 2009-06-24 -mtime: 2010-07-07 -change: allow custom format for get_time() and format_date() +mtime: 2011-01-13 +change: remove reference to show_orphan You can call functions only from [[template_mako]], not from [[pages|pageformat]]. If you need the latter, look at [[macros]]. @@ -77,7 +77,7 @@ You'll need to specify "`root`" if your top-most page isn't named "`Home`". Defined in [[hierarchy.py|hierarchy]], where you find an example. -== get_linear_sitemap(root, show_orphans, level) == +== get_linear_sitemap(root, level) == Returns all pages as "`(level, page, link)`" tuples, where "`page`" is a "`class File`"-object and link is a relative link from the current page to @@ -87,9 +87,6 @@ You'll need to specify "`root`" if your top-most page isn't named "`Home`". The "`level`" will by default start at 1. -To put pages into the sitemap that are outside the parent/child relationships, -specify "`True`" for "`show_orphans`". - Defined in [[hierarchy.py|hierarchy]], where you find an example. == get_toc() == diff --git a/plugins/hierarchy.py b/plugins/hierarchy.py index 184d66b..5217e24 100644 --- a/plugins/hierarchy.py +++ b/plugins/hierarchy.py @@ -137,50 +137,32 @@ def get_sidemenu(root="Home", level=1): @set_function("get_hierarchical_sitemap") -def get_hierarchical_sitemap(root="Home", show_orphans=False): +def get_hierarchical_sitemap(root="Home"): page = get_current_file() if not isinstance(root, webber.File): root = get_file_for(root) - visited = {root: True} def do_menu(pg): res = [] if _childs.has_key(pg): for p in _childs[pg]: subpage = p[1] - visited[subpage] = True res.append( do_menu(subpage) ) return (pg, get_link_from(root, pg), res) res = do_menu(root) - if show_orphans: - for f in files: - #print f - file = files[f] - if not file.has_key("linktitle"): - continue - try: - if file in visited: - #print "found", file.linktitle - continue - except KeyError: - continue - #print "not found:", file.linktitle - res.append( (file, get_link_from(page, file.title), []) ) - #import pprint #pprint.pprint(res, indent=4) return res @set_function("get_linear_sitemap") -def get_linear_sitemap(root="Home", show_orphans=False, level=1): +def get_linear_sitemap(root="Home", level=1): page = get_current_file() if not isinstance(root, webber.File): root = get_file_for(root) - visited = {root: None} res = [(0, root, get_link_from(page, root))] def do_menu(pg, level): @@ -193,26 +175,10 @@ def get_linear_sitemap(root="Home", show_orphans=False, level=1): #print "subpage:", subpage link = get_link_from(page, subpage) res.append((level, subpage, link)) - visited[subpage] = None do_menu(subpage, level+1) do_menu(root, level) - #print "visited:", visited - if show_orphans: - for f in files: - #print f - file = files[f] - if not file.has_key("linktitle"): - continue - try: - if file in visited: - #print "found", file.linktitle - continue - except KeyError: - continue - #print "not found:", file.linktitle - res.append( (0, file, get_link_from(page, file.title))) #import pprint #pprint.pprint(res) return res -- 2.39.2