Commit Graph

180 Commits

Author SHA1 Message Date
Aditya Bansal face3562af Clean subscription_settings.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal bdcff375ab Clean deactivated-users-admin.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal 4c1b89a2ef Clean attachment-item.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal e5d57c31b8 Clean muted-topics-settings.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal 2a15fa17b9 Clean admin_auth_methods_list.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal c0ca8b10ed Clean deactivation-stream-modal.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal 0e906b683d Clean realm-domains-modal.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal 257b930492 Clean admin-realm-domains-list.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal e21731c1ae Clean streams-list-admin.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal 71c5444b86 Clean alert-word-settings.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Aditya Bansal b11866c2a8 Clean message_edit_form.handlebars to use 4 space indents. 2017-04-18 12:06:25 -07:00
Tomasz Kolek a8633e0975 integrations doc: Move twitter doc to separate file. 2017-04-05 13:43:48 -07:00
Tomasz Kolek 85940aef7f integrations doc: Move trac doc to separate file. 2017-04-05 13:43:48 -07:00
Tomasz Kolek d8ed13740d integrations doc: Move subversion doc to separate file. 2017-04-05 13:43:48 -07:00
Tomasz Kolek 5426725c43 integrations doc: Move openshift doc to separate file. 2017-04-05 13:43:47 -07:00
Tomasz Kolek 484fef059b integrations doc: Move nagios doc to separate file. 2017-04-05 13:43:47 -07:00
Tomasz Kolek 489a7d1784 integrations doc: Move mercurial doc to separate file. 2017-04-05 13:43:47 -07:00
Tomasz Kolek 372c7224f0 integrations doc: Move jira-plugin doc to separate file. 2017-04-05 13:43:47 -07:00
Tomasz Kolek bd1103373d integrations doc: Move google-calendar doc to separate file. 2017-04-05 13:43:47 -07:00
Tomasz Kolek 6ff130b829 integrations doc: Move git doc to separate file. 2017-04-05 13:43:47 -07:00
Tomasz Kolek cbe00e020c integrations doc: Move capistrano doc to separate file. 2017-04-05 13:37:37 -07:00
Tomasz Kolek 5b17622589 docs: Move integrations.html to integrations/index.html.
Add omiting rule for all of integrations docs in test_templates.
2017-04-05 13:19:58 -07:00
Harshit Bansal 0605a9fb0f templates: Rename `admin-alias-list.handlebars`.
Rename `admin-alias-list.handlebars` to
`admin-realm-domains-list.handlebars`.

Fixes: #3145.
2017-04-04 15:48:03 -07:00
Elliott Jin 2e246a936f tools: Support checking specific files in `check-templates`. 2017-03-19 14:13:38 -07:00
Elliott Jin 357e1a001f refactor: Move `check-templates` argument parsing to top level. 2017-03-19 14:13:38 -07:00
Elliott Jin 0d677042e7 tools: Remove assert in template linter.
Currently, in the case where `--modified` is not passed, the linter asserts
that it's checking at least 10 files.  Removing this (somewhat arbitrary)
check makes it easier to:

- Add support for specifying files to check via command line arguments
- Reason about cases where `check-templates` is called from `lint-all`
2017-03-19 14:13:38 -07:00
adnrs96 dd52291fa5 linter: Add support for automatic checking for 4 space indents in HTML. 2017-03-14 14:50:16 -07:00
Tim Abbott b0f53fd1a8 check-templates: Check left and right sidebars. 2017-03-01 09:08:09 -08:00
Tim Abbott 0712926b84 templates: Rename right-sidebar.html to right_sidebar.html. 2017-03-01 09:02:15 -08:00
Tim Abbott 748ec32349 templates: Rename left-sidebar.html to left_sidebar.html. 2017-03-01 09:00:51 -08:00
sinwar eab355b0cd tools: Create more consistent checks for venv.
This helps make the Zulip development environment somewhat more robust
to new contributors, since it will give them a nice warning if they
try running any of our development tools outside the Zulip virtualenv.

Fixes #3468.
2017-02-06 21:50:32 -08:00
Tim Abbott bd6f71580e docs: Remove obsolete terms-enterprise page.
This was documentation for the old zulip.com enterprise service that
no longer exists.
2017-01-28 18:12:19 -08:00
Tomasz Kolek 6e6cbeb89d Split webhooks doc and move to particular directories. 2017-01-26 11:56:45 -08:00
Tim Abbott e385b93448 lint: Clean up E713 PEP-8 rule. 2017-01-23 21:08:52 -08:00
Tim Abbott 22d1aa396b lint: Clean up W503 PEP-8 warning. 2017-01-23 20:50:04 -08:00
Rohith Asrk 9088c46e4c templates: Fix filename ending with .html.txt.
Fixes a part of #3136.
2017-01-21 22:44:13 -08:00
adnrs96 153ad18807 Lint for duplicate ids in templates.
In this commit we enhance our current template linter to detect
duplicate ids and report them during lint checks. html_branches.py
was topped up with a new function build_id_dict for the purpose.

Also the get_tag_info function in same file was updated to parse
ids and classes more robustly in cases of template variables.
split_for_id_and_class function was added to serve this purpose.

Unit tests for both the functions were created under
tests/test_html_branches. Also a directory under tests called
test_template_data was created to hold templates for testing under
newly created functionality.

check_templates was modified to print to console any duplicates
detected.
showell reviewed my commit and helped me out.

Fixes #2950.
2017-01-13 17:00:22 -08:00
reallyly 94b28e0afb pep8: Fix E128 violations.
With some line-wrapping tweaks by tabbott.
2016-12-13 10:50:14 -08:00
Gordon P. Hemsley 1e9a4b2bab Switch tools/check-templates from optparse to argparse. 2016-09-12 12:00:16 -07:00
Steve Howell 5af47e0eef Make fn param optional with template_parser.validate().
The caller can now pass in text directly.  This is mostly for
testing, but it could be useful in other situations.
2016-08-04 10:47:09 -07:00
Steve Howell 9151ee42e9 Extract tools/lib/template_parser.py. 2016-08-01 16:27:50 -07:00
Steve Howell 9951e92b3b Extract tokenize() in tools/check-templates. 2016-08-01 16:05:07 -07:00
Steve Howell 7e772ed644 Clean up code in check-templates.
I extracted a few helper methods.
2016-08-01 16:05:07 -07:00
Tim Abbott ed95c34b83 check-templates: Remove now-removed terms.html. 2016-07-30 09:56:54 -07:00
Eklavya Sharma ab8890b304 Annotate tools/check-templates. 2016-07-24 21:04:32 +05:30
Eklavya Sharma 2f889550cb tools/check-templates: Use __init__ in Record.
Initialize Record by using __init__ instead of setting attributes
in validate.  This is needed because mypy complains when we set
new attributes outside __init__.
2016-07-24 21:04:32 +05:30
Eklavya Sharma ecf2249536 tools/check-templates: Set modified's default to False.
Set default value of options.modified to False.
2016-07-24 21:04:31 +05:30
Eklavya Sharma 9c177fcd1b tools/check-templates: Remove unneeded return. 2016-07-24 21:04:31 +05:30
Tim Abbott baeaf0f870 check-templates: Fix traceback with missing closing tag at end of file.
Previously, this would crash with an unclear traceback in this situation.
2016-07-13 18:55:40 -07:00
Tim Abbott 0b7788be6b Fix indentation in compose.html. 2016-07-12 18:36:02 -07:00
Tim Abbott d424813687 Fix indentation in deactivated.html. 2016-07-12 18:34:17 -07:00
Steve Howell f57a17abdf Lint-check more Django files for indentation.
(This starts to address github ticket #1236.)
2016-07-12 14:08:17 -07:00
Steve Howell 97f28f3792 Revert "Close HTML singleton tags in Casper files."
This reverts commit 520b255d95,
and also blacklists Casper files from our linter.
2016-07-12 13:35:50 -07:00
Steve Howell 538bc61c54 Check more html files in check-templates.
Instead of just checking .html files in the templates directory,
we now also check them everywhere, including .html files used
for Casper tests and some static files.
2016-07-09 17:34:49 -07:00
Steve Howell 704c57a141 Fix end tag issues in api.html
(This fixes a minor style issue with the API keys/bots section,
but the change is mostly to make the HTML have balanced tags.)
2016-07-08 16:30:49 -07:00
Steve Howell 6154c73125 Support -m flag to check only modified templates. 2016-07-08 16:30:49 -07:00
Steve Howell d1964a243e Use lister module to find files for linting. 2016-07-08 16:30:49 -07:00
Steve Howell 1006b95898 Extract check_handlebar_templates. 2016-07-08 16:30:49 -07:00
Steve Howell 4e326ed138 Extract check_django_templates. 2016-07-08 16:30:49 -07:00
Steve Howell 3e9ceaeaf0 Move templates check to ok() function. 2016-07-08 16:30:49 -07:00
Taranjeet a137bf15ed Wrap some lines with length greater than 120.
With some tweaks by tabbott.
2016-07-06 14:35:16 -07:00
Eklavya Sharma 1a6257394c Make tools/lint-all run on python 3.
Since pyflakes catches some extra errors in python 3, disable
pyflakes for now.
2016-05-25 19:23:13 +05:30
Umair Khan 5359e6b0d4 Convert Zulip to use Jinja2 templates.
This results in a substantial performance improvement for all of
Zulip's backend templates.

Changes in templates:
- Change `block.super` to `super()`.
- Remove `load` tag because Jinja2 doesn't support it.
- Use `minified_js()|safe` instead of `{% minified_js %}`.
- Use `compressed_css()|safe` instead of `{% compressed_css %}`.
- `forloop.first` -> `loop.first`.
- Use `{{ csrf_input }}` instead of `{% csrf_token %}`.
- Use `{# ... #}` instead of `{% comment %}`.
- Use `url()` instead of `{% url %}`.
- Use `_()` instead of `{% trans %}` because in Jinja `trans` is a block tag.
- Use `{% trans %}` instead of `{% blocktrans %}`.
- Use `{% raw %}` instead of `{% verbatim %}`.

Changes in tools:
- Check for `trans` block in `check-templates` instead of `blocktrans`

Changes in backend:
- Create custom `render_to_response` function which takes `request` objects
  instead of `RequestContext` object. There are two reasons to do this:
    1. `RequestContext` is not compatible with Jinja2
    2. `RequestContext` in `render_to_response` is deprecated.
- Add Jinja2 related support files in zproject/jinja2 directory. It
  includes a custom backend and a template renderer, compressors for js
  and css and Jinja2 environment handler.
- Enable `slugify` and `pluralize` filters in Jinja2 environment.

Fixes #620.
2016-05-09 09:55:18 -07:00
Vladislav Manchev 52e96915e2 check-templates: Allow HTML tag brackets inside tag attributes. 2016-05-08 16:33:03 -07:00
Eklavya Sharma 14130a84ca Partially apply Python 3 transform libpasteurize.fixes.fix_newstyle
Refer to #256
2016-03-12 23:19:56 +05:30
Eklavya Sharma b9e792c4e6 Apply Python 3 futurize transform libmodernize.fixes.fix_xrange_six
Refer to #256
2016-03-10 22:03:58 -08:00
Eklavya Sharma aa505b0d55 Apply Python 3 futurize transform libmodernize.fixes.fix_map
Refer to #256
2016-03-10 22:03:44 -08:00
Eklavya Sharma def027a1ec Apply Python 3 futurize transform libmodernize.fixes.fix_filter
Refer to #256
2016-03-10 22:03:06 -08:00
Josh Mandel bdb9535251 Don't require link tags to close when checking templates. 2016-01-07 23:08:49 -08:00
Ahmed Shibani 47d8d784a2 Add 'blocktrans' to tools/check-templates.
Running check-templates test fails when there are 'blocktrans' tags in
django templates. The fix is to add 'blocktrans' to
is_django_block_tag function in check-templates.
2015-11-03 08:06:48 -08:00
Steven Oud d5435fad1d Consistently use /usr/bin/env python2.7 in shebangs and commands. 2015-10-21 22:58:21 +00:00
Steve Howell f4764e58c6 Check Django block tags in check-templates.
(imported from commit a5d6336eeba63df365d3e59dce4d7f32aae637c7)
2014-02-27 20:25:40 -05:00
Steve Howell 98bc0b04c5 Clean up handling of HTML tags in check-templates.
(imported from commit 10f3ce97eecefcedc806d1a6a20ad230ebcf1f0f)
2014-02-27 20:25:40 -05:00
Steve Howell a07299f1d6 Clean up while loop in check-templates.
(imported from commit 79c2cc2b1ced0fc80b0a1996fd9150b39e689a31)
2014-02-27 20:25:40 -05:00
Steve Howell 9da693c371 Simplify pulling out of tags in check-templates.
Before this change, the way we'd strip tags of punctuation
was just sort of messed up, because we'd strip the start tags
one way and strip the end tags another, and we had conditionals
for the different flavors of tags, instead of doing the stripping
when we already knew what flavor of tag we were dealing with.

(imported from commit 60c5ebd45e21b88bbfc98ff4b43dbbc6b32b38a1)
2014-02-27 20:25:39 -05:00
Steve Howell bf5ebf1d2d Check that handlebars tags are balanced in check-templates.
(imported from commit 4a36b874f5dab314cf5af5357bf0250d6fc1bd8b)
2014-02-27 20:25:37 -05:00
Steve Howell f22665e710 Extract matching_tags() in check-templates.
(imported from commit bf54e656ba5f924298270c8e76b60faf78689099)
2014-02-27 20:25:37 -05:00
Steve Howell 7e49396fc5 Extract get_html_tag in check-templates.
(imported from commit 365a2bb4e9b2bf94f7b8e16a40fec0b461b64ab8)
2014-02-27 20:25:37 -05:00
Steve Howell c7a9e08105 Extract check_our_files in check-templates.
(imported from commit 68049b19aacfb159a92e7142b9975a5376c0f9f5)
2014-02-27 20:25:37 -05:00
Steve Howell ea49e9d1b0 Rename check-handlebar-templates to check-templates.
(It's been checking Django templates too.)

(imported from commit e1a92210d07dfd68666a8c93642c4eb8d5ff081f)
2013-12-17 12:44:59 -05:00