From 1c91d1a5bc92845c97df39ade1b6ca679268faad Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 18 Nov 2013 16:57:55 -0500 Subject: [PATCH] Clean up back end HTML templates. The check-handlebars-templates script now looks at most of our back end templates to try and find imbalanced tags. This commit fixes a bunch of the existing templates. (imported from commit fad4a5d85d68160370dd588b41d6f125f64d198f) --- .../alert_word_settings_item.handlebars | 2 +- templates/404.html | 2 +- templates/500.html | 2 +- templates/confirmation/confirm.html | 6 +-- templates/corporate/features.html | 2 +- templates/corporate/mit.html | 4 +- templates/corporate/signup.html | 4 +- templates/corporate/zephyr-mirror.html | 3 -- templates/corporate/zephyr.html | 7 +-- templates/openid_error.html | 2 +- templates/zerver/accounts_accept_terms.html | 2 +- templates/zerver/accounts_send_confirm.html | 2 +- templates/zerver/apps.html | 5 ++- templates/zerver/integrations.html | 10 +++-- templates/zerver/login.html | 2 +- templates/zerver/privacy.html | 2 +- templates/zerver/register.html | 2 +- tools/check-handlebar-templates | 45 +++++++++++++------ 18 files changed, 60 insertions(+), 44 deletions(-) diff --git a/static/templates/alert_word_settings_item.handlebars b/static/templates/alert_word_settings_item.handlebars index 8c0afffa86..c7e5b3ac14 100644 --- a/static/templates/alert_word_settings_item.handlebars +++ b/static/templates/alert_word_settings_item.handlebars @@ -1,7 +1,7 @@ {{! Alert word in the settings page that can be removed }}
  • {{#if editing}} - + {{else}} {{word}} {{/if}} diff --git a/templates/404.html b/templates/404.html index 0da79abcb0..c02cc610a0 100644 --- a/templates/404.html +++ b/templates/404.html @@ -5,7 +5,7 @@ {% block portico_content %}
    -

    404: Page not found.

    +

    404: Page not found.

    We know this is stressful, but we still love you.

    diff --git a/templates/500.html b/templates/500.html index aa1cef00ed..9366b0d434 100644 --- a/templates/500.html +++ b/templates/500.html @@ -10,7 +10,7 @@ {% block portico_content %}
    -

    500: Internal server error.

    +

    500: Internal server error.

    Well oops. This one's probably our fault. Sorry about that!

    diff --git a/templates/confirmation/confirm.html b/templates/confirmation/confirm.html index 8755a0b633..1a54b1a885 100644 --- a/templates/confirmation/confirm.html +++ b/templates/confirmation/confirm.html @@ -8,16 +8,16 @@

    You're confirmed. We're not exactly sure what we confirmed you for, but whatever it is you're totally good.

    {% else %} -

    Whoops, something's not right. We couldn't find your confirmation ID!

    +

    Whoops, something's not right. We couldn't find your confirmation ID!

    {% if enterprise % } -

    Make sure you copied the link correctly in to your browser.

    +

    Make sure you copied the link correctly in to your browser.

    If you're still having problems, please contact your Zulip administrator at {{ support_email }}.

    {% else % }

    Make sure you copied the link correctly in to your browser. If you're - still encountering this page, its probably our fault. We're sorry.

    + still encountering this page, its probably our fault. We're sorry.

    Anyway, shoot us a line at {{ support_email }} and we'll get diff --git a/templates/corporate/features.html b/templates/corporate/features.html index 3d16c909d2..703240001c 100644 --- a/templates/corporate/features.html +++ b/templates/corporate/features.html @@ -54,7 +54,7 @@

    @-notifications

    Want someone's attention in a conversation? @-notify them - and they'll be right over. + and they'll be right over.

    diff --git a/templates/corporate/mit.html b/templates/corporate/mit.html index 169b12244a..d1e5a8c435 100644 --- a/templates/corporate/mit.html +++ b/templates/corporate/mit.html @@ -58,9 +58,7 @@

    If you have any questions, please contact us using the "Send feedback" button in Zulip or e-mail us - at support@zulip.com

    + at support@zulip.com

    -
    - {% endblock %} diff --git a/templates/corporate/signup.html b/templates/corporate/signup.html index 51c239e00c..15d2ab9cc6 100644 --- a/templates/corporate/signup.html +++ b/templates/corporate/signup.html @@ -45,7 +45,7 @@ id="name" name="name" placeholder="Wolfgang A. Mozart" />, and you can email me at . + placeholder="w.a.mozart@magicflute.com" />.

    I work at of us, and today we use to chat.

    + name="product" placeholder="IRC" /> to chat.

    - - {% endblock %} diff --git a/templates/corporate/zephyr.html b/templates/corporate/zephyr.html index dc0a1c180a..373273ce89 100644 --- a/templates/corporate/zephyr.html +++ b/templates/corporate/zephyr.html @@ -17,7 +17,7 @@

    You're done!

    If you have any questions, please contact us using the "Send feedback" button in Zulip or e-mail us at -support@zulip.com

    +support@zulip.com

    If you want to automatically transfer your existing Zephyr subscriptions

    @@ -36,7 +36,7 @@ home view that you less commonly read. You can still easily access those streams from Zulip when you want to read them. You can control your subscriptions and what's in your home view by clicking the gear in the upper right-hand corner - and then selecting "Streams".

    + and then selecting "Streams".

  • If you subscribe to any encrypted Zephyr classes

    @@ -48,7 +48,4 @@

    - - - {% endblock %} diff --git a/templates/openid_error.html b/templates/openid_error.html index 8ee44c8e36..13d8cb65f1 100644 --- a/templates/openid_error.html +++ b/templates/openid_error.html @@ -5,7 +5,7 @@ {% block portico_content %}
    -

    We couldn't validate your Google account

    +

    We couldn't validate your Google account

    You might want to try logging in via Google again or log in with a username or password.

    diff --git a/templates/zerver/accounts_accept_terms.html b/templates/zerver/accounts_accept_terms.html index 685d9d1074..33cb714697 100644 --- a/templates/zerver/accounts_accept_terms.html +++ b/templates/zerver/accounts_accept_terms.html @@ -20,7 +20,7 @@ Allow the user to accept the terms, creating an email record of that fact.
    -

    {{ email }}

    +

    {{ email }}

    diff --git a/templates/zerver/accounts_send_confirm.html b/templates/zerver/accounts_send_confirm.html index bafbd90c61..9203cd6045 100644 --- a/templates/zerver/accounts_send_confirm.html +++ b/templates/zerver/accounts_send_confirm.html @@ -6,7 +6,7 @@

    Thanks for signing up!

    -

    Check your email so we can get started.

    +

    Check your email so we can get started.

    Still no email? We can resend it.
    (Just in case, take a look at your Spam folder.)

    diff --git a/templates/zerver/apps.html b/templates/zerver/apps.html index 601aaf9b02..0bf146484f 100644 --- a/templates/zerver/apps.html +++ b/templates/zerver/apps.html @@ -53,7 +53,7 @@

    Note: The latest versions of the Mac app require Mac OS X 10.7+. If you are running OS X 10.6 (Snow Leopard), please - download this version instead.

    + download this version instead.

    {% if not_enterprise %} @@ -89,10 +89,11 @@ sudo apt-get install zulip-desktop-sso

    Other

    {% if not_enterprise %}

    We provide a binary tarball of the Zulip application, built for 64-bit systems. +

    {% else %}

    We provide a binary tarball of the Zulip application, built for 64-bit systems. +

    {% endif %} -

    diff --git a/templates/zerver/integrations.html b/templates/zerver/integrations.html index a2d231945f..e0cfe39cc8 100644 --- a/templates/zerver/integrations.html +++ b/templates/zerver/integrations.html @@ -185,7 +185,7 @@

    You will need your Basecamp account ID. You can find it as a sequence of numbers in the URL when you log in:

    Edit the Basecamp and Zulip credentials in integrations/basecamp/zulip_basecamp_config.py using - your favorite editor: + your favorite editor:

    @@ -210,7 +210,7 @@

    Congratulations! You're done!
    Whenever you create a new project, calendar event, comment, message, or more, you'll get a notification in your selected stream - with the project or calendar as the topic. + with the project or calendar as the topic.

    @@ -792,9 +792,10 @@ following, to the stream commits with a subject that matches the re
    • Did you set up a post-build action for your project?
    • Does the stream you picked (e.g. jenkins) already exist? If not, add yourself to it and try again.
    • -
    • Are your access key and email address correct? Test them using our curl API. +
    • Are your access key and email address correct? Test them using our curl API.
    • Still stuck? Email support@zulip.com.
    +

    @@ -872,6 +873,7 @@ following, to the stream commits with a subject that matches the re

    In the Administrators page, navigate to Plugins > Other > Script Listeners. In the Add Listener section, click on the Custom Listener option. Select the events you wish the Zulip integration to fire for, and the projects you wish Zulip to be notified for. In the Name of groovy class field, enter org.zulip.jira.ZulipListener. +

    Click Add Listener, and JIRA will now notify your Zulip of changes to your issues!

    @@ -911,6 +913,7 @@ key=NAGIOS_BOT_API_KEY GROUPS section of /etc/nagios3/conf.d/contacts.cfg, doing something like: +

    define contactgroup{
             contactgroup_name       admins
    @@ -958,6 +961,7 @@ key=NAGIOS_BOT_API_KEY
                https://github.com/zulip/phabricator-to-zulip
               
             to get it set up.
    +      

    diff --git a/templates/zerver/login.html b/templates/zerver/login.html index 16eafbb8fe..0af13f6155 100644 --- a/templates/zerver/login.html +++ b/templates/zerver/login.html @@ -74,7 +74,7 @@ autofocus('#id_username');
    - +
    {% endif %} diff --git a/templates/zerver/privacy.html b/templates/zerver/privacy.html index 9d9c3a337e..b144df0b65 100644 --- a/templates/zerver/privacy.html +++ b/templates/zerver/privacy.html @@ -166,7 +166,7 @@ opt-in consent for the sharing of any sensitive personal information.

  • -

    With domain administrators +

    With domain administrators

    If your Zulip Account is managed for you by a domain administrator then your domain administrator and resellers who provide user support to your diff --git a/templates/zerver/register.html b/templates/zerver/register.html index 380c00307c..d31c0a37ad 100644 --- a/templates/zerver/register.html +++ b/templates/zerver/register.html @@ -33,7 +33,7 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser

    -

    {{ email }}

    +

    {{ email }}

  • diff --git a/tools/check-handlebar-templates b/tools/check-handlebar-templates index c0723c3f65..61a65e3e8f 100755 --- a/tools/check-handlebar-templates +++ b/tools/check-handlebar-templates @@ -6,13 +6,19 @@ import subprocess class Record: pass -def validate(fn): +def validate(fn, check_indent=True): text = open(fn).read() state = Record() def NoStartTag(end_tag): - raise Exception('No start tag for %s' % end_tag) + raise Exception(''' + No start tag + fn: %s + end tag: + %s + line %d, col %d + ''' % (fn, end_tag, state.line, state.col)) def start_tag_matcher(s): start_line = state.line @@ -25,7 +31,7 @@ def validate(fn): problem = None if start_tag != end_tag[2:-1]: problem = 'Mismatched tag.' - elif state.line > start_line + 1 and state.col != start_col: + elif check_indent and state.line > start_line + 1 and state.col != start_col: problem = 'Bad indentation.' if problem: raise Exception(''' @@ -40,7 +46,7 @@ def validate(fn): ''' % (fn, problem, s, start_line, start_col, end_tag, state.line, state.col)) state.matcher = old_matcher state.depth -= 1 - return f + state.matcher = f state.depth = 0 state.i = 0 @@ -71,24 +77,37 @@ def validate(fn): if s.startswith(''): - state.matcher = start_tag_matcher(s) + tag = s[1:-1].split()[0] + ignore = s.startswith('