Author: rpmcruz
Date: Thu Dec 3 13:27:38 2009
New Revision: 59927
URL: http://svn.opensuse.org/viewcvs/yast?rev=59927&view=rev
Log:
* src/YGUtils.cc: proper fix for bug 549943: we
can't blindly ignore break-lines as white-space.
How yast2-qt renders HTML is by ignoring white-space
after a tag has been open (and only on open).
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGUtils.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=59927&r1=59926&r2=59927&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Thu Dec 3 13:27:38 2009
@@ -1,3 +1,10 @@
+2009-12-03 Ricardo Cruz
+
+ * src/YGUtils.cc: proper fix for bug 549943: we
+ can't blindly ignore break-lines as white-space.
+ How yast2-qt renders HTML is by ignoring white-space
+ after a tag has been open (and only on open).
+
2009-12-02 Ricardo Cruz
* src/YGUtils.cc: bug fix 549943: HTML to XHTML
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=59927&r1=59926&r2=59927&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Thu Dec 3 13:27:38 2009
@@ -126,7 +126,7 @@
GQueue *tag_queue = g_queue_new();
int i = 0;
- gboolean was_space = TRUE, pre_mode = FALSE;
+ gboolean allow_space = FALSE, pre_mode = FALSE;
skipSpace (instr, &i);
// we must add an outer tag to make GMarkup happy
@@ -239,6 +239,8 @@
if (is_close || is_open_close)
g_string_free (tag, TRUE);
+
+ allow_space = is_close; // don't allow space after opening a tag
}
else if (instr[i] == '&') { // Entity
@@ -263,20 +265,17 @@
else
g_string_append_c (outp, instr[i]);
}
- was_space = FALSE;
+ allow_space = TRUE;
}
else { // Normal text
if (!pre_mode && g_ascii_isspace (instr[i])) {
- // completely ignore breaklines unlike other whitespace
- if (instr[i] != '\n') {
- if (!was_space)
- g_string_append_c (outp, ' ');
- was_space = TRUE;
- }
+ if (allow_space)
+ g_string_append_c (outp, ' ');
+ allow_space = FALSE; // one space is enough
}
else {
- was_space = FALSE;
+ allow_space = TRUE;
g_string_append_c (outp, instr[i]);
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org