-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean Django templates to use 4 space indents #3764
Conversation
Automated message from Dropbox CLA bot @adnrs96, it looks like you've already signed the Dropbox CLA. Thanks! |
@timabbott I think this is ready to merge, although you might want to look at markdown_help.html as interesting case of where the pretty printer leaves some of the original dubious formatting intact. |
e6726d0
to
7fe8cb9
Compare
I have updated the PR with changes to |
I merged a few commits, thanks @adnrs96! Posted some comments on chat.zulip.org on a few issues; I think there's a couple small bugs in the formatter for Jinja2 templates. |
7fe8cb9
to
8a92df6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for doing the next batch of this @adnrs96!
I merged a bunch more of these; posted a few comments on things that seem like they still need some work...
templates/zerver/base.html
Outdated
|
||
</html> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, had a look and turns out to be issue with non block django tags.
templates/zerver/invite_user.html
Outdated
<div class="controls"> | ||
<textarea rows="2" id="invitee_emails" | ||
name="invitee_emails" | ||
placeholder="{{ _('One or more email addresses...') }}"></textarea> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
placeholder
is over-indented here.
templates/zerver/markdown_help.html
Outdated
<td class="preserve_spaces">``` .py | ||
</tr> | ||
<tr> | ||
<td class="preserve_spaces">``` .py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This <td>
spacing seems off?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a manual error. markdown_help actually needs manual editing after running tool.
Will fix it.
8a92df6
to
8db0c55
Compare
Thanks for reviewing and merging. I have updated this PR with new commits. It turns out there were some overlooked issue in tooling with respect to django tags which do not have a block structure and end tags indents. Now that is fixed and the PR #3658 has also been updated with commit containing changes in tooling. |
I merged another batch of these, with a few manual changes.
|
8db0c55
to
b981a81
Compare
Thank you for this. I am curious about the whitespace and zuliprc stuff you mentioned. I quite don't follow what you meant by zuliprc output? |
Just added new commits 3 of which have been merged already last time, namely files
I am afraid to tell you that we missed out some thing in these files which the tool didn't fixed indentation properly for (was a kind of bug in tool, now resolved and updated in commit here under this PR#3658). The new commits have those updates. Please review and advice. |
So the features.html and integrations.html changes that Brock was working on are now merged, so you can add commits for those when you get a chance. |
left sidebar has some merge conflicts so you should probably regenerate that one; I merged the rest. |
Probably now's a good time to analyze the files that still need to migrate and which PRs are important to merge for this... |
Sure let me run the analyser again. |
2d6b628
to
bb0136c
Compare
Just updated the PR with new commits. Here is a list of PR's which should be cleared to proceed further. templates/zerver/compose.html PR#3118(+1-2) PR#2721(+1-0) Also i wanted to know about api.html and markdown stuff relating to it you talked about. |
#3905 is merged, and I think we shouldn't worry about ultra-old PRs (e.g. <2000) with 1 line of changes. |
bb0136c
to
5303dbd
Compare
Updated with new commit's. Also cleaned files which are in PR's 1954, 749, 1747. These PR's either had merge conflicts for these files already or very minimal change. Updated the list as well. |
I merged a few. With |
5303dbd
to
1ad0f26
Compare
Yes just noticed it. This |
I think the medium-term plan is to port a lot of that documentation into markdown, so maybe not worth worrying about. |
62f70f8
to
60208fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adnrs96: Thanks for your work on this!
A few more recommendations. This is minor, but for future reference, please include the section of the codebase that your commit affects at the front of the commit message (for example integrations/asana.html: Migrate to Markdown.
) Please see our Git Guide and commit message guidelines for more information. Its good to adhere to this because it makes a lot easier for reviewers to browse our Git logs and PRs. :)
And one last thing, if you plan to migrate more integrations' docs to Markdown, please try to wrap it at 80 characters (its easier to read with two files open side by side). There are exceptions to this (e.g. long URLs). :)
@adnrs96, @timabbott: Apart from my comment above, this looks good to me for now! I'm sure our future migration efforts will constitute more iterative improvements to the framework!
Thanks! :)
context['integration_name'] = integration.name | ||
context['integration_display_name'] = integration.display_name | ||
except KeyError: | ||
pass | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this part could be more concise and elegant, and therefore less error prone. :) Here's an example:
if context.get('integrations_dict') is not None:
integration_dir = None
if markdown_file_path.endswith('doc.md'):
integration_dir = markdown_file_path.split('/')[0]
elif 'integrations' in markdown_file_path.split('/'):
integration_dir = splitext(basename(markdown_file_path))[0]
integration = context['integrations_dict'][integration_dir]
context['integration_name'] = integration.name
if integration.name == 'bitbucket2':
context['integration_name'] = 'bitbucket'
context['integration_display_name'] = integration.display_name
if hasattr(integration, 'url'):
context['integration_url'] = integration.url[3:]
Also, splitext
and basename
come from os.path
, so make sure to add from os.path import basename, splitext
at the top of the file.
The integration.name == 'bitbucket2'
conditional will soon be removed in favor of a more general approach, making this even conciser. But its fine for now, because I'm still working on that part of the framework. ;)
One more recommendation, instead of catching a KeyError
and doing nothing (using pass
), it's cleaner to do something like:
if context['integrations_dict'].get(integration_dir) is not None:
doSomeStuff()
In my opinion, its always good to keep the amount of code that should be wrapped in a try
block to the absolute minimum. (Specificity is good!) :)
Heads up @adnrs96, we just merged some commits (latest: 7f15cfe) that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the |
I went through these and merged the things that I could. Thanks for doing this @adnrs96 and reviewing this @eeshangarg! I made a few changes:
I agree with @eeshangarg that we should clean up the Since this PR is getting cluttered, I'm going to close it and we can continue on a new one. Thanks for all your work on this so far @adnrs96 ! |
In this PR we continue the work being done in PR #3658 to clean up the django templates located in
/templates/zerver/
to follow 4 space indentation. The improvements to pretty_print tool has been pushed as a commit to PR #3658. All the files cleaned up in this PR does not pose any merge conflicts with other open PR 's.