Article¶
- class reahl.web.bootstrap.ui.Article(view, css_id=None)¶
An independent section of informational content.
Styling
Renders as an HTML <article> element.
- Parameters
view – (See
reahl.web.fw.Widget)css_id – (See
reahl.web.ui.HTMLElement)
New in version 3.2.
This module houses stylised versions of very basic user interface elements – user interface elements that have a one-to-one correspondence to HTML elements (or are of similar simplicity).
A Slot is a placeholder area on a page into which different Views can plug different Widgets on the fly.
Using Slots, one can create a single HTML5page which can be re-used by different Views instead of having to create similar-looking HTML5Pages for each View in an application.
A Slot is added to an HTML5Page to represent an area that will be populated later by a View. When a View is served up the framework can then populate this empty area with Widgets specific to the current View.
view – (See reahl.web.fw.Widget)
name – A name for this Slot (must be unique on the page)
A visual badge proclaiming that a website is “Running on Reahl”. Using it on your site is a bit of advertising for Reahl!
Styling
Renders as an HTML <a class=”runningon”> containing an <img>
view – (See reahl.web.fw.Widget)
An HTML TextNode. You can, for example, use a TextNode to add a snippet of text as a child of a P inbetween its other children (which will all be HTMLElements, like Span).
view – (See reahl.web.fw.Widget)
value_or_getter – A string which will be used as the text of the TextNode. Pass a no-arg callable instead to delay the computation of what the text of the TextNode should be to the time of rendering the TextNode. The callable will be called right before the TextNode is rendered, and should return the text that should be used in the TextNode.
html_escape – If True (default), the given value will first be HTML-escaped before rendered to the browser.
Returns an HTML representation of this Widget. (Not for general use, may be useful for testing.)
The title of an HTML page (the title of a reahl.web.fw.View is usually shown via a Title).
Styling
Rendered as a <title> element.
view – (See reahl.web.fw.Widget)
text – A string for use in a PEP-292 template. The final value after substituting this string Template will be used as the value of this Title. The template string may use one placeholder: $current_title which contains the title of the current View.
css_id – (See reahl.web.ui.HTMLElement)
A link to an external resource.
Styling
Renders as an HTML <link> element.
view – (See reahl.web.fw.Widget)
rel – The value of the “rel” attribute of this HTMLElement.
href – The value of the “href” attribute of this HTMLElement.
_type – The value of the “type” attribute of this HTMLElement.
css_id – (See reahl.web.ui.HTMLElement)
Changed in version 3.2: Changed _type to be an optional, keyword argument instead of a positional argument.
A container for metadata of a View.
Styling
Renders as an HTML <head> element.
view – (See reahl.web.fw.Widget)
title – Text for a template to be used as document Title (See also Title).
css_id – (See reahl.web.ui.HTMLElement)
The content of an HTML document.
Styling
Renders as an HTML <body> element.
view – (See reahl.web.fw.Widget)
css_id – (See reahl.web.ui.HTMLElement)
Adds another Widget (child) as a child Widget of this one.
the added child for convenience.
A logical grouping of other HTMLElements which fits in with text flow.
Styling
Renders as an HTML <span> element.
view – (See reahl.web.fw.Widget)
text – Will be added as text content of the Span if given.
css_id – (See reahl.web.ui.HTMLElement)
The LiteralHTML Widget renders a chunk of HTML as given in contents. If a single-argument callable is given as transform, contents will first be passed to that callable to possibly change the HTML on-the-fly before rendering (the callable should return the changed HTML to be rendered).
view – (See reahl.web.fw.Widget)
contents – Some literal HTML.
transform – If given, it is called passing contents to possibly transform contents before rendering. The callable should return the final HTML to be rendered.
Returns an HTML representation of this Widget. (Not for general use, may be useful for testing.)
A hyper link.
Styling
Renders as an HTML <a> element.
view – (See reahl.web.fw.Widget)
href – The URL (or URL fragment) to which the hyperlink leads.
description – The textual description to be shown on the hyperlink.
ajax – (Not for general use)
read_check – (See reahl.web.fw.Widget)
write_check – (See reahl.web.fw.Widget)
css_id – (See reahl.web.ui.HTMLElement)
Creates an A for the given bookmark on view.
Creates a reahl.web.fw.WidgetFactory for creating an A for the given bookmark.
Override this method if you want to change the attributes of this HTMLElement on the fly, based on the state of the HTMLElement at the point in time when it is rendered.
Override this method if your Widget needs JavaScript to be activated on the browser side.
Explicitly sets whether this hyperlink is “active” or not. An active hyperlink cannot be clicked on, because conceptually, the user is already at its target.
active – A boolean – send True if active, else False.
The heading for a section.
Styling
Renders as an HTML <h1>, <h2> … , <h6> element, depending on priority.
view – (See reahl.web.fw.Widget)
priority – The heading level (a value from 1 to 6)
text – The text value displayed in the heading (if given)
css_id – (See reahl.web.ui.HTMLElement)
A paragraph of text.
Styling
Renders as an HTML <p> element.
view – (See reahl.web.fw.Widget)
text – The text value displayed in the paragraph (if given)
css_id – (See reahl.web.ui.HTMLElement)
html_escape – If text is given, by default such text is HTML-escaped. Pass False in here to prevent this from happening.
A complicated paragraph may consist of many TextNodes interspersed with other Widgets. Creating such a
paragraph programmatically is cumbersome. Instead, the text of a P can be a template resembling
a PEP-292 template. This format method works analogously to
string.format(), except that Widgets can be passed in to be substituted into the original P.
args – Positional arguments for substituting into the “template P”
kwargs – Named arguments for substituting into the “template P”
A logical grouping of other HTMLElements.
Styling
Renders as an HTML <div> element
view – (See reahl.web.fw.Widget)
css_id – (See reahl.web.ui.HTMLElement)
An independent section of informational content.
Styling
Renders as an HTML <article> element.
view – (See reahl.web.fw.Widget)
css_id – (See reahl.web.ui.HTMLElement)
A grouping of elements representing metadata pertaining to a section, such as an Article.
Styling
Rendered as an HTML <article> element.
view – (See reahl.web.fw.Widget)
css_id – (See reahl.web.ui.HTMLElement)
A list item.
Styling
Renders as an HTML <li> element.
view – (See reahl.web.fw.Widget)
css_id – (See reahl.web.ui.HTMLElement)
An unordered list.
Styling
Renders as an HTML <ul> element.
view – (See reahl.web.fw.Widget)
css_id – (See reahl.web.ui.HTMLElement)
An ordered list.
Styling
Renders as an HTML <ol> element.
view – (See reahl.web.fw.Widget)
css_id – (See reahl.web.ui.HTMLElement)
An embedded image.
Styling
Renders as an HTML <img> element.
view – (See reahl.web.fw.Widget)
src – The URL from where the embedded image file should be fetched.
alt – Alternative text describing the image.
css_id – (See reahl.web.ui.HTMLElement)
A caption for an reahl.web.ui.HTMLElement.
New in version 3.2.
Styling
Rendered as an HTML <legend> element.
view – (See reahl.web.fw.Widget)
text – If given, the Legend containing this text.
css_id – (See reahl.web.ui.HTMLElement)
A message box meant to alert the user of some message.
See also: Badge.
view – (See reahl.web.fw.Widget)
message_or_widget – Message text or a Widget to display inside the Alert.
severity – One of ‘primary’, ‘secondary’, ‘success’, ‘info’, ‘warning’, ‘danger’, ‘light’, ‘dark’ to indicate the color scheme for the Alert.