Skip to content

Add djangofmt HTML formatter#2736

Draft
niklasmohrin wants to merge 5 commits into
e-valuation:mainfrom
niklasmohrin:djangofmt
Draft

Add djangofmt HTML formatter#2736
niklasmohrin wants to merge 5 commits into
e-valuation:mainfrom
niklasmohrin:djangofmt

Conversation

@niklasmohrin

Copy link
Copy Markdown
Member

Closes #1777

<div class="callout callout-info small">
{% if editable %}
{% blocktranslate %}Please review the evaluation's details below, add all contributors and select suitable questionnaires. Once everything is okay, please approve the evaluation on the bottom of the page.{% endblocktranslate %}
{% blocktranslate %}Please review the evaluation's details below, add all contributors and select suitable

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we noticed these breaks in blocktranslates, we should probably add trimmed then; will look into contributing or reporting this to djangofmt

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richardebeling So there is a builtin lint that all blocktranslates should be trimmed which we can apply with djangofmt check . --fix. Not sure if that is what we want though, seems to add more noise. Maybe we should contribute a setting so that trimmed is only needed/added if the blocktranslate spans more than one line?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think always putting in trimmed is fine: We only use blocktranslate, if we expect the contents to be larger/more complex, and in those cases, trimmed is basically always appropriate.

We have 117 occurrences of blocktranslate, I think it would be manageable. We can do it separately (PR/commit).

@richardebeling richardebeling left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50 files viewed, looks generally good, thanks

Comment on lines +5 to +6
{% blocktranslate with percentage=weight_info %}This evaluation contributes {{ percentage }} to the final grade
of the course.{% endblocktranslate %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to somehow get trimmed in

Comment thread evap/staff/templates/staff_semester_preparation_reminder.html
Comment thread evap/staff/templates/staff_semester_preparation_reminder.html
Comment on lines +6 to +7
{% endspaceless %}
<!DOCTYPE html>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just wrong?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both the old and the new code are correct. Whitespace before a DOCTYPE are legal. We could also juts remove the spaceless block here.

@richardebeling richardebeling left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

103 files look good to me. 17 files need blocktranslate trimmed fixed, then they are also good.

Comment on lines +100 to +101
Please confirm that a grade document for the course <strong
>{{ course_name }}</strong> will be uploaded later on.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a few linebreaks like thus, inside the strong tag. A bit weird, but doesn't happen too often, so 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Template formatting and linting

2 participants