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

Extract first line from multi-line thing description for the ThingTyp… #1306

Merged
merged 1 commit into from
Feb 10, 2022

Conversation

FSeidinger
Copy link
Contributor

Fixes issue #1304 by extracting the first line of a multi-lined thing description.

@FSeidinger FSeidinger requested a review from a team as a code owner February 9, 2022 10:46
@FSeidinger FSeidinger force-pushed the fix/thing-description-rendering branch from 45a0559 to cc39fd6 Compare February 9, 2022 10:51
…e list item

Signed-off-by: Frank Seidinger <fs@frank-seidinger.de>
@FSeidinger FSeidinger force-pushed the fix/thing-description-rendering branch from cc39fd6 to 461202c Compare February 9, 2022 10:53
@ghys
Copy link
Member

ghys commented Feb 9, 2022

Thanks - although IMHO it would be enough to just split the string on <br and take the first part (see my remark @ #1304 (comment)), building DOM elements seems a little overkill, wdyt?

@FSeidinger
Copy link
Contributor Author

FSeidinger commented Feb 9, 2022

Thanks - although IMHO it would be enough to just split the string on <br and take the first part (see my remark @ #1304 (comment)), building DOM elements seems a little overkill, wdyt?

As mentioned in the issue, you will find this solution as a standard for coping with inner HTML. I personally do not have any worries on computational power or memory consumption for just temporarily creating a single <div> tag and parse some lines of HTML.

Bonus is that the script is easy to read and comprehend and the call is very short and also much more comprehend-able than the very long line with ternary operator and two or three parenthesis stacks.

But hey, I just tried to help. At last this is not my code and I have no preferences on it, beside that the bug gets fixed :-)

In the end, you decide.

Copy link
Member

@ghys ghys left a comment

Choose a reason for hiding this comment

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

Ok, fair enough :)

@ghys ghys merged commit 8b91b23 into openhab:main Feb 10, 2022
@ghys ghys added bug Something isn't working main ui Main UI labels Feb 10, 2022
@ghys ghys added this to the 3.3 milestone Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working main ui Main UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants