From ef24582d92be53cc60a27a9daef85b2963803701 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Thu, 1 Jul 2010 10:51:12 +0200 Subject: [PATCH] toc.py, hierarchy.py: add new "Hide: true" page attribute --- in/index.md | 1 - in/overview.md | 1 + in/pageformat.md | 7 +++++++ plugins/hierarchy.py | 5 +++++ plugins/toc.py | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/in/index.md b/in/index.md index 2f9800c..29d57b7 100644 --- a/in/index.md +++ b/in/index.md @@ -2,7 +2,6 @@ title: Webber ctime: 2009-06-24 mtime: 2009-06-24 -* [[overview]] * [[pageformat]] * [[configuration]] * [[commandline]] diff --git a/in/overview.md b/in/overview.md index 992ba39..ffcb759 100644 --- a/in/overview.md +++ b/in/overview.md @@ -1,6 +1,7 @@ title: Overview parent: Webber ctime: 2009-06-24 +hide: true *Webber* is a static web-site generation tool, loosely based on ideas from IkiWiki and my own likings. diff --git a/in/pageformat.md b/in/pageformat.md index dd477c1..e032481 100644 --- a/in/pageformat.md +++ b/in/pageformat.md @@ -116,6 +116,13 @@ name. For convenience, you can ommit "`.tmpl`". template: history +== hide == + + hide: true + +will hide the generated page from in the plugins [[hierarchy]] and [[toc]]. + + == description == Anything you specify here will be accessible in the template as ${description}. diff --git a/plugins/hierarchy.py b/plugins/hierarchy.py index 92279c3..2c9c4dc 100644 --- a/plugins/hierarchy.py +++ b/plugins/hierarchy.py @@ -43,6 +43,11 @@ def memorize_parent(title, parent, order=100): @set_hook("scan") def scan(params): file = params["file"] + + # Ignore hidden pages + if file.has_key("hide") and file.hide: + return + if file.has_key("links"): memorize_links(file.linktitle, file.links) if file.has_key("parent"): diff --git a/plugins/toc.py b/plugins/toc.py index fa22cc3..41d31dc 100644 --- a/plugins/toc.py +++ b/plugins/toc.py @@ -82,6 +82,10 @@ def linkify(params): _labels = {} _first = -1 + # Ignore hidden pages + if params.file.has_key("hide") and params.file.hide: + return + # Very small pages don't need a table-of-contents if params.file.contents.count("\n") < toc_min_lines: return -- 2.39.2