Skip to content
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

[IMP] util/fields: update default when converting to html #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

diagnoza
Copy link
Contributor

One could use Python escape sequences in text fields. When converting a field to HTML, they will no longer work, so replace them with HTML tags.

Before:

+--------------------------------------------------------------------------------------------------------------------------------------+
| json_value                                                                                                                           |
|--------------------------------------------------------------------------------------------------------------------------------------|
| "Mise en place du chantier\n\nIntervention pour une mise en arrêt de la chaudière\n\nVérification responsable\nRepli fin de travaux" |
+--------------------------------------------------------------------------------------------------------------------------------------+

After:

+-----------------------------------------------------------------------------------------------------------------------------------------------------+
| json_value                                                                                                                                          |
|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| "Mise en place du chantier<br/><br/>Intervention pour une mise en arrêt de la chaudière<br/><br/>Vérification responsable<br/>Repli fin de travaux" |
+-----------------------------------------------------------------------------------------------------------------------------------------------------+

opw-4133947

@diagnoza diagnoza requested review from a team and Pirols October 24, 2024 16:33
@robodoo
Copy link
Contributor

robodoo commented Oct 24, 2024

Pull request status dashboard

@diagnoza diagnoza force-pushed the master-update_html_default-owi branch from cd5ce4c to e9d5416 Compare October 24, 2024 16:35
Comment on lines 663 to 666
SET json_value = REPLACE(
REPLACE(json_value, '\n', '<br/>'),
'\t', '&nbsp;&nbsp;&nbsp;&nbsp;'
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use pg_text2html

UPDATE ir_default AS d
SET json_value = REPLACE(
REPLACE(json_value, '\n', '<br/>'),
'\t', '&nbsp;&nbsp;&nbsp;&nbsp;'
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be part of pg_text2html.
Instead of 4 spaces, we can use the &emsp; entity (em space, U+2003)

Copy link
Contributor

Choose a reason for hiding this comment

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

we can use the &emsp; entity

Or just &Tab;.

@diagnoza diagnoza force-pushed the master-update_html_default-owi branch 2 times, most recently from 1a8ffaa to 595dd43 Compare October 30, 2024 20:02
@diagnoza
Copy link
Contributor Author

CI seems wrong to indicate a syntax error.

@diagnoza diagnoza requested a review from KangOl October 30, 2024 20:49
@aj-fuentes
Copy link
Contributor

You cannot use f-strings in the utils. It must be Python2 compatible.

One could use Python escape sequences in text fields. When
converting a field to HTML, they will no longer work, so replace
them with HTML tags.
@diagnoza diagnoza force-pushed the master-update_html_default-owi branch from 595dd43 to 84f0d0f Compare October 31, 2024 12:56
@diagnoza
Copy link
Contributor Author

upgradeci retry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants