From 04c1249b098e6c163e5c438a56ba25d60c344173 Mon Sep 17 00:00:00 2001 From: nikicc Date: Mon, 28 Aug 2017 13:37:04 +0200 Subject: [PATCH 1/2] CorpusViewer: Break long urls --- orangecontrib/text/widgets/owcorpusviewer.py | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/orangecontrib/text/widgets/owcorpusviewer.py b/orangecontrib/text/widgets/owcorpusviewer.py index 9df84ef66..d4cd587e7 100644 --- a/orangecontrib/text/widgets/owcorpusviewer.py +++ b/orangecontrib/text/widgets/owcorpusviewer.py @@ -245,6 +245,26 @@ def show_docs(self): vertical-align: top; padding-right: 10px; }} + + .content {{ + /* Adopted from https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/ */ + + /* These are technically the same, but use both */ + overflow-wrap: break-word; + word-wrap: break-word; + + -ms-word-break: break-all; + /* This is the dangerous one in WebKit, as it breaks things wherever */ + word-break: break-all; + /* Instead use this non-standard one: */ + word-break: break-word; + + /* Adds a hyphen where the word breaks, if supported (No Blink) */ + -ms-hyphens: auto; + -moz-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; + }} .token {{ padding: 3px; @@ -297,7 +317,7 @@ def show_docs(self): if is_image and value != '?': value = ''.format(value) html += '{}:' \ - '{}'.format( + '{}'.format( feature.name, mark, value) if self.show_tokens: From 28efe46c809de0852dba97ca8239827935af0e3b Mon Sep 17 00:00:00 2001 From: Lan Zagar Date: Tue, 29 Aug 2017 10:06:07 +0200 Subject: [PATCH 2/2] CorpusViewer: Show newlines using
--- orangecontrib/text/widgets/owcorpusviewer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orangecontrib/text/widgets/owcorpusviewer.py b/orangecontrib/text/widgets/owcorpusviewer.py index d4cd587e7..0b8bf57f8 100644 --- a/orangecontrib/text/widgets/owcorpusviewer.py +++ b/orangecontrib/text/widgets/owcorpusviewer.py @@ -312,7 +312,7 @@ def show_docs(self): for ind in self.display_indices: feature = self.display_features[ind] mark = 'class="mark-area"' if feature in marked_search_features else '' - value = str(index.data(Qt.UserRole)[feature.name]) + value = str(index.data(Qt.UserRole)[feature.name]).replace('\n', '
') is_image = feature.attributes.get('type', '') == 'image' if is_image and value != '?': value = ''.format(value)