Mercurial > moin > 2.0
changeset 1320:8fa27ecd73f8
eliminate HTML5 validation errors caused by meta tags with unregistered names
author | Roger Haase <crosseyedpenguin@yahoo.com> |
---|---|
date | Sat, 31 Mar 2012 12:48:37 -0700 |
parents | 97398f9a6324 |
children | cc7067f61939 46b5ce342d4e 65b22a88c412 |
files | MoinMoin/static/js/common.js MoinMoin/templates/base.html MoinMoin/templates/show.html |
diffstat | 3 files changed, 21 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/static/js/common.js Fri Mar 30 12:21:17 2012 -0700 +++ b/MoinMoin/static/js/common.js Sat Mar 31 12:48:37 2012 -0700 @@ -787,13 +787,8 @@ commentsHideTitle = titles[1]; jQuery('.moin-toggle-comments-button > a').attr('title', commentsHideTitle); } - // show or hide comments based on user option or default option: - // show comments if there is a <meta name="moin-show-comments" content="1" /> - if (document.getElementsByName('moin-show-comments').length > 0) { - show_comments = document.getElementsByName('moin-show-comments')[0].content; - } - if (show_comments !== '1') { - // user option is to hide comments + // comments are visible; per user option, hide comments if there is not a <br id="moin-show-comments" /> + if (!document.getElementById('moin-show-comments')) { toggleComments(); } } @@ -973,8 +968,8 @@ } function guessContentType() { - /* Used in the modify_text template to guess the data content type client-side - * This approach has the advantage of reacting to content type changes for the + /* Used in the modify_text template to guess the data content type client-side + * This approach has the advantage of reacting to content type changes for the * link/transclude code without having to re-fetch the page */ var meta_text = $("#f_meta_text").val(); var ctype_regex = /["']contenttype["']\s*:\s*["']([\w-_+.]+\/[\w-_+.]+)(;|["'])/;
--- a/MoinMoin/templates/base.html Fri Mar 30 12:21:17 2012 -0700 +++ b/MoinMoin/templates/base.html Sat Mar 31 12:48:37 2012 -0700 @@ -11,13 +11,6 @@ {% if pi_refresh -%} {{ '<meta http-equiv="refresh" content="%d;URL=%s" />' % pi_refresh }} {%- endif %} - {%- if item_name and allow_doubleclick and - user.edit_on_doubleclick and user.may.write(item_name) -%} - <meta name="edit_on_doubleclick" content="1" /> - {%- endif %} - {%- if user.show_comments -%} - <meta name="moin-show-comments" content="1" /> - {%- endif %} {% for name, content in theme_supp.meta_items -%} <meta name="{{ name }}" content="{{ content }}" /> {% endfor %} @@ -72,5 +65,12 @@ {% block layout %} <h1>Extend this block only if you want to change layout. If you want to put content, extends layout.html and use placeholders item and content.</h1> {% endblock %} + +<div id="moin-options-for-javascript" style="display: none"> +{% block options_for_javascript %} + {# implement this block to pass server side options to client side javascript. #} +{% endblock %} +</div> + </body> </html>
--- a/MoinMoin/templates/show.html Fri Mar 30 12:21:17 2012 -0700 +++ b/MoinMoin/templates/show.html Sat Mar 31 12:48:37 2012 -0700 @@ -46,7 +46,7 @@ {{ rev_navigation(view='frontend.show_item') }} {% endblock %} {% endif %} - + {% block headline %} {# <h1>{{ rev.item.name }} {% if show_revision %}(Revision {{ rev.revid }}){% endif %}</h1> #} {% endblock %} @@ -79,3 +79,12 @@ </p> {% endif %} {% endblock %} + +{% block options_for_javascript %} +{%- if item_name and user.edit_on_doubleclick and user.may.write(item_name) -%} + <br id="moin-edit_on_doubleclick" /> +{%- endif %} +{%- if user.show_comments -%} + <br id="moin-show-comments" /> +{%- endif %} +{% endblock %}