page
page
#
Page — a website folder: index.html beside every file it shows.
- Declare.
Page.declare(root, title=, at=)— what acg.ui.PageBuilderfunction returns — records a component tree and what the page is the page of; nothing is written yet, andatmay still be set. - Build.
build()— or the store that seals the value — renders the tree once into the page's folder:index.htmlat the root, staged files underfiles/, browser libraries underlib/. A hand-made folder holding anindex.htmlis a page as it stands (Page.load(folder), or the plain folder address every directory scalar answers to). - Read.
titleis the<title>ofindex.html, on a built or wrapped page alike.
Page
#
Bases: DirScalar
A page: a component tree rendered to a self-contained website folder.
Analysis-only: the result of a page function in a target module, never part of a procedure schema. The value is the folder, so it seals like any other directory; the server hosts it at the URL of the value it is the page of.
title is the page's display name everywhere it is listed — index cards,
link cards, the browser chrome — so derive it from the data the page shows
rather than repeating the function's name. at is the value the page is
the page of; links from the page are relative to its position, and it stays
settable until the page is built.
@cgserver.page(Journal, lambda s: s.sessions.for_each(), version=1)
@cg.ui.PageBuilder()
def overview(session: Session) -> None:
cg.ui.Title(session.captured.date().isoformat())
cg.ui.Markdown("# Overview")
cg.ui.ImageViewer(session.photo)
Source code in capturegraph-lib/capturegraph/types/special/page.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
at
property
writable
#
The value this page is the page of; settable until the page is built.
title
property
#
The declared title, or for a wrapped folder the <title> of its index.html.
__init__(*segments)
#
Take the website folder at segments as a page as it stands.
Source code in capturegraph-lib/capturegraph/types/special/page.py
build()
#
Render the tree into this folder, once; a built or wrapped page is returned as is.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a |
Source code in capturegraph-lib/capturegraph/types/special/page.py
declare(root, *, title=None, at=None)
classmethod
#
A page to be rendered from root into a fresh folder in the recipe workspace.
cg.ui.PageBuilder calls this with the stack its function built.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Component
|
The component tree to render. |
required |
title
|
str | None
|
The page's display name. |
None
|
at
|
object | None
|
The value this page is the page of; settable until the page is built. |
None
|
Raises:
| Type | Description |
|---|---|
ScratchNotConfigured
|
If no scratch is configured. |
Source code in capturegraph-lib/capturegraph/types/special/page.py
load(base)
classmethod
#
The website folder at base.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in capturegraph-lib/capturegraph/types/special/page.py
store(base, value)
classmethod
#
Build value if it is not yet built, then copy its folder into base.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in capturegraph-lib/capturegraph/types/special/page.py
title_of(html)
#
The text of the first <title> in html, or None when it has none.