Permalink
Browse files

[enhance] stdlib/Templates: adding <em> and <strong> tags.

  • Loading branch information...
1 parent 3c7078f commit 45f8692bcc8355148a4be1e5176d1ca7d3509b83 @akoprow akoprow committed Dec 8, 2011
Showing with 17 additions and 1 deletion.
  1. +6 −0 stdlib/web/template/template_base_engine.opa
  2. +11 −1 stdlib/web/template/template_type.opa
@@ -612,6 +612,8 @@ import stdlib.web.client
| "base" -> parse_with(base_attrs, (base_attribute -> { base; ~base_attribute }))
| "header" -> standard_tag({header})
| "footer" -> standard_tag({footer})
+ | "em" -> standard_tag({em})
+ | "strong" -> standard_tag({strong})
| tag -> { failure = {unsupported_tag; ~tag; ns="" } }
end
| { ~failure } -> { ~failure }
@@ -663,6 +665,8 @@ import stdlib.web.client
| {tfoot} -> <tfoot>{children}</>
| {header} -> <header>{children}</>
| {footer} -> <footer>{children}</>
+ | {em} -> <em>{children}</>
+ | {strong} -> <strong>{children}</>
@private standard_tag_to_string(tag : Template.standard_tag) =
match tag with
@@ -701,6 +705,8 @@ import stdlib.web.client
| {tfoot} -> "tfoot"
| {header} -> "header"
| {footer} -> "footer"
+ | {em} -> "em"
+ | {strong} -> "strong"
/**
* The default engine : It can process default tags like div or span.
@@ -270,11 +270,21 @@ type Template.anchor_attribute = {
; standard_attribute : Template.standard_attribute
}
+/* missing tags from http://www.w3schools.com/tags/default.asp
+ Tags that we certainly do not want to support in templates:
+ <applet>, <frame>, <frameset>, <iframe>, <noframes>, <noscript>,
+ <object>, <script>
+ Tags that we may want to include at some point:
+ <area>, <b>, <bdo>, <big>, <button>, <cite>, <code>, <col />,
+ <colgroup>, <dfn>, <i>, <kbd>, <map>, <param>, <samp>, <small>
+ <style>, <tt>, <var>
+ */
+
type Template.standard_tag =
{div} / {address} / {acronym} / {fieldset} / {legend} / {pre} / {sub} / {sup} /
{abbr} / {ins} / {del} / {dd} / {dt} / {dl} / {h1} / {h2} / {h3} / {h4} / {h5} /
{h6} / {open} / {span} / {menu} / {ul} / {ol} / {li} / {paragraph} / {caption} /
- {table} / {thead} / {tbody} / {tr} / {tfoot} / {header} / {footer}
+ {table} / {thead} / {tbody} / {tr} / {tfoot} / {header} / {footer} / {em} / {strong}
/**
* An AST which represents a typed tree of

0 comments on commit 45f8692

Please sign in to comment.