Tayra

Template. Script. Distribute

html – Handlers for standard html5 tags

Module provides a plugin to handle standard html5 tags.

Module contents

class tayra.tags.html.HTML5(pa, *args, **kwargs)[source]

Bases: tayra.tags.Tags

Basic plugin to handle most of the HTML5 tags. Other than the common set of tokens and specifiers supported by the base tayra.tags.Tags this plugin defines other tokens that are specific to each tag. Individual tags are handle by their corresponding method prefixed with ‘tag_‘. Refer to them for more details about the tags.

tag_a(mach, tagname, tokens, attributes, content)[source]

<a> tag handler. Supported tokens,

  • a quoted string token is interpreted as href attribute and translated to href="<string>"
tag_abbr(mach, tagname, tokens, attributes, content)[source]

<abbr> tag handler. Supported tokens,

  • a quoted string token is interpreted as title attribute and translates to title="<string>"
tag_area(mach, tagname, tokens, attributes, content)[source]

<area> tag handler. Supported tokens,

  • If token is of the form //<shape>:<coords>// it translates to shape="<shape>" coords="<coords>" attributes.
  • a quoted string token is interpreted as href attribute and translated to href="<string>".
tag_audio(mach, tagname, tokens, attributes, content)[source]

<audio> tag handler. Support tokens,

  • autoplay token translates to autoplay="autoplay"
  • controls token translates to controls="controls"
  • loop token translates to loop="loop"
  • auto token translates to preload="auto"
  • metadata token translates to preload="metadata"
  • none token translates to preload="none"
  • a quoted string is interpreted as src attribute and translates to src="<string>"
tag_base(mach, tagname, tokens, attributes, content)[source]

<base> tag handler. Supported tokens,

  • If a token is present it is interpreted as target attribute and translates to target="<token>"
tag_blockquote(mach, tagname, tokens, attributes, content)[source]

<blockquote> tag handler. Supported tokens,

  • a quoted string is interpreted as cite attribute and translates to cite="<string>"
tag_br(mach, tagname, tokens, attributes, content)[source]

<br> tag handler.

tag_button(mach, tagname, tokens, attributes, content)[source]

<button> tag handler. Supported tokens,

  • button token translates to type="button".
  • reset token translates to type="reset".
  • submit token translates to type="submit".
  • autofocus token translates to autofocus="autofocus".
  • application/x-www-form-urlencoded token translates to formenctype="application/x-www-form-urlencoded".
  • multipart/form-data token translates to formenctype="multipart/form-data".
  • text/plain token translates to formenctype="text/plain".
  • get token translates to formmethod="get".
  • post token translates to formmethod="post".
  • formnovalidate token translates to formnovalidate="formnovalidate".
  • _blank token translates to target="_blank".
  • _self token translates to target="_self".
  • _parent token translates to target="_parent".
  • _top token translates to target="_top".
  • If a token starts with frame:<frametarget> it will be translated to frametarget="<frametarget>".
  • If a token starts with form:<formname> it will be translated to form="<formname>".
  • a quoted string is interpreted as formaction attribute and translates to formaction="<string>".
tag_canvas(mach, tagname, tokens, attributes, content)[source]

<canvas> tag handler. Supported tokens,

  • If a specifier token is of the form <width>,<height> it translates to width="<width>" height="<height>".
tag_col(mach, tagname, tokens, attributes, content)[source]

<col> tag handler. Supported tokens,

  • If a token is present, it will be interpreted as span attribute and translates to span="<span>"
tag_colgroup(mach, tagname, tokens, attributes, content)[source]

<colgroup> tag handler. Supported tokens,

  • If a specifier token is present, it will be interpreted as span attribute and translates to span="<span>"
tag_command(mach, tagname, tokens, attributes, content)[source]

<command> tag handler. Supported tokens,

  • checkbox token translates to type="checkbox"
  • command token translates to type="command"
  • radio token translates to type="radio"
  • a quoted string is interpreted as icon attribute and translated to icon="<string>".
tag_del(mach, tagname, tokens, attributes, content)[source]

<del> tag handler. Supported tokens,

  • If a non quoted token is present, it will interpreted as datetime attribute and translates to datetime="<token>"
  • a quoted string is interpreted as cite attribute and translated to cite="<string>"
tag_detail(mach, tagname, tokens, attributes, content)[source]

<details> tag handler. Supported tokens,

  • open token translates to open="open"
tag_embed(mach, tagname, tokens, attributes, content)[source]

<embed> tag handler. Supported tokens,

  • If token of the form <width>,<height> it translates to width="<width>" height="<height>".
  • a quoted string is interpreted as src attribute and translated to src="<string>".
tag_fieldset(mach, tagname, tokens, attributes, content)[source]

<fieldset> tag handler. Supported tokens,

  • If a token is of the form f:<formname>, it translates to form="<formname>".
tag_form(mach, tagname, tokens, attributes, content)[source]

<form> tag handler. Supported tokens,

  • on token translates to autocomplete="on".
  • off token translates to autocomplete="off".
  • application/x-www-form-urlencoded token translates to enctype="application/x-www-form-urlencoded".
  • multipart/form-data token translates to enctype="multipart/form-data".
  • text/plain token translates to enctype="text/plain".
  • get token translates to method="get"
  • post token translates to method="post"
  • novalidate token translates to novalidate="novalidate"
  • a quoted string is interpreted as action attribute and translated to action="<string>".
tag_head(mach, tagname, tokens, attributes, content)[source]

<head> tag handler. Supported tokens,

  • a quoted string is interpreted as manifest attribute and translated to manifest="<string>".
tag_hr(mach, tagname, tokens, attributes, content)[source]

<hr> tag handler.

tag_html(mach, tagname, tokens, attributes, content)[source]

<html> tag handler. Supported tokens,

  • a quoted string is interpreted as manifest attribute and translated to manifest="<string>".
tag_iframe(mach, tagname, tokens, attributes, content)[source]

<frame> tag handler. Supported tokens,

  • seamless token translated to seamless="seamless".
  • If a token is of the form <width>,<height> where width and height are integers, it translates to width="<width>" height="<height>".
  • If a token starts with allow- it will be joined together as comma separated value to sandbox attribute.
  • a quoted string is interpreted as src attribute and translated to src="<string>"
tag_img(mach, tagname, tokens, attributes, content)[source]

<img> tag handler. Supported tokens,

  • ismap token translates to ismap="ismap"
  • If a token is of the form <width>,<height> it is translated to width="<width>" height="<height>".
  • a quoted string is interpreted as src attribute and translated to src="<string>"
tag_input(mach, tagname, tokens, attributes, content)[source]

<input> handler

tag_ins(mach, tagname, tokens, attributes, content)[source]

<ins> tag handler. Supported tokens,

  • If a token is present it will interpreted as datetime attribute and translated to datetime="<token>".
  • a quoted string is interpreted as cite attribute and translated to cite="<string>".
tag_keygen(mach, tagname, tokens, attributes, content)[source]

<keygen> handler

tag_label(mach, tagname, tokens, attributes, content)[source]

<label> tag handler. Supported tokens,

  • If a token looks like f:<formname>, it will be translated to form="<formname>"
  • Otherwise the token will be translated to for="<token>".
tag_li(mach, tagname, tokens, attributes, content)[source]

<li> tag handler. Supported tokens,

  • If a token is present it will be translated to value="<token>".

<link> tag handler. Supported tokens,

  • If a token is present it will be translated to type="<token>".
  • a quoted string is interpreted as cite attribute and translated to href="<string>".
tag_menu(mach, tagname, tokens, attributes, content)[source]

<menu> tag handler. Supported tokens,

  • If a token is present it will be translated to type="<token>".
  • a quoted string is interpreted as label attribute and translated to label="<string>".
tag_meta(mach, tagname, tokens, attributes, content)[source]

<meta> tag handler. Supported tokens,

  • If a token is present it will be translated to http-equiv="<token>".
  • a quoted string is interpreted as content attribute and translated to content="<string>".
tag_meter(mach, tagname, tokens, attributes, content)[source]

<meter> tag hanlder. Supported tokens,

  • If a token starts with f:<formname> it will be translated to form="<formname>".
  • If a token is of the form low < high it will be translated to low="<low>" high="<high>"
  • If a token is of the form low < optimum < high it will be translated to low="<low>" optimum="<optimum>" high="<high>".
  • Otherwise the token will be interpreted as value attribute and translated as value="<value>".
tag_object(mach, tagname, tokens, attributes, content)[source]

<object> tag handler. Supported tokens,

  • If a token starts with form: it will be translated to form="<formname>".
  • If a token is of the form <width>,<height> it will be translated to width="<width>" height="<height>".
  • a quoted string is interpreted as data attribute and translated as data="<string>".
tag_ol(mach, tagname, tokens, attributes, content)[source]

<ol> tag handler. Supported tokens,

  • reversed token translates to reversed="reversed".
  • 1 token translates to type="1".
  • A token translates to type="A".
  • ‘’a’’ token translates to type="a".
  • ‘’l’’ token translates to type="l".
  • ‘’i’’ token translates to type="i".
  • If a token is of the form <type>,<start>, it will be translated to type="<type>" start="<start>".
tag_optgroup(mach, tagname, tokens, attributes, content)[source]

<optgroup> tag handler. Supported tokens,

  • a quoted string is interpreted as label attribute and translated to label="<string>".
tag_option(mach, tagname, tokens, attributes, content)[source]

<option> tag handler. Supported tokens,

  • a quoted string is interpreted as value attribute and translated as value="<string>".
tag_output(mach, tagname, tokens, attributes, content)[source]

<output> tag handler. Supported tokens,

  • If a token is of the form <form>:<name> it will be translated to form="<form>" for="<name>".
tag_param(mach, tagname, tokens, attributes, content)[source]

<param> tag handler. Supported tokens,

  • a quoted string is interpreted as value attribute and translated as value="<string>".
tag_progress(mach, tagname, tokens, attributes, content)[source]

<progress> tag handler. Supported tokens,

  • If token is of the form <max>,<value> it will be translated to max="<max>" value="<value>".
tag_q(mach, tagname, tokens, attributes, content)[source]

<q> tag handler. Supported tokens,

  • a quoted string is interpreted as value attribute and translated to cite="<string>".
tag_script(mach, tagname, tokens, attributes, content)[source]

<script> tag handler. Supported tokens,

  • async token translates to async="async".
  • ‘’defer’’ token translates to defer="defer".
  • Otherwise it will be interpreted as type attribute and translated to type="<token>".
  • a quoted string is interpreted as src attribute and as src="<string>".
tag_source(mach, tagname, tokens, attributes, content)[source]

<source> tag handler. Supported tokens,

  • If a token is present it will be interpreted as type attribute and translated to type="<token>".
  • a quoted string is interpreted as src attribute and as src="<string>".
tag_style(mach, tagname, tokens, attributes, content)[source]

<style> tag handler. Supported tokens,

  • text/css token translates to type="text/css".
  • scoped token translates to scoped="scoped".
  • a quoted string is interpreted as src attribute and as src="<string>".
tag_table(mach, tagname, tokens, attributes, content)[source]

<table> tag handler. Supported tokens,

  • 1 token translates to border="1".
tag_time(mach, tagname, tokens, attributes, content)[source]

<time> tag handler. Supported tokens,

  • If a token is present it will be interpreted as pubdate attribute and translated as pubdate="<token>".
  • a quoted string is interpreted as datetime attribute and translated as datetime="<string>".
tag_track(mach, tagname, tokens, attributes, content)[source]

<track> handler

tag_wbr(mach, tagname, tokens, attributes, content)[source]

<wbr> handler

Table Of Contents

Related Topics

This Page