Fix formatting of whitespace errors
The class name needs to be obfuscated when we render the text. Change-Id: Icfd3d1cff4d47b5c789905063dc016fa69e7d258 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
f2c211f6ad
commit
63e211f75f
|
@ -166,6 +166,4 @@ public interface GerritCss extends CssResource {
|
|||
String topmost();
|
||||
String useridentity();
|
||||
String version();
|
||||
String visualtab();
|
||||
String whitespaceerror();
|
||||
}
|
||||
|
|
|
@ -71,14 +71,6 @@
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.visualtab {
|
||||
border: 1px dotted red;
|
||||
}
|
||||
|
||||
.whitespaceerror {
|
||||
background: red;
|
||||
}
|
||||
|
||||
.inputFieldTypeHint {
|
||||
color: grey;
|
||||
}
|
||||
|
|
|
@ -108,13 +108,13 @@ public abstract class PrettyFormatter {
|
|||
|
||||
|
||||
private static SafeHtml showTabAfterSpace(SafeHtml src) {
|
||||
return src.replaceFirst("^( *\t)",
|
||||
"<span class=\"gerrit-whitespaceerror\">$1</span>");
|
||||
return src.replaceFirst("^( *\t)", "<span class=\""
|
||||
+ Resources.I.css().whitespaceerror() + "\">$1</span>");
|
||||
}
|
||||
|
||||
private static SafeHtml showTrailingWhitespace(SafeHtml src) {
|
||||
return src.replaceFirst("([ \t][ \t]*)(\r?\n?)$",
|
||||
"<span class=\"gerrit-whitespaceerror\">$1</span>$2");
|
||||
return src.replaceFirst("([ \t][ \t]*)(\r?\n?)$", "<span class=\""
|
||||
+ Resources.I.css().whitespaceerror() + "\">$1</span>$2");
|
||||
}
|
||||
|
||||
protected SafeHtml prettify(SafeHtml line) {
|
||||
|
@ -123,6 +123,7 @@ public abstract class PrettyFormatter {
|
|||
|
||||
private static class Pretty extends PrettyFormatter {
|
||||
static {
|
||||
Resources.I.prettify_css().ensureInjected();
|
||||
Resources.I.css().ensureInjected();
|
||||
|
||||
eval(Resources.I.core());
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2009 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gwtexpui.safehtml.client.prettify;
|
||||
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
|
||||
public interface PrettyCss extends CssResource {
|
||||
String visualtab();
|
||||
String whitespaceerror();
|
||||
}
|
|
@ -23,7 +23,10 @@ public interface Resources extends ClientBundle {
|
|||
public static final Resources I = GWT.create(Resources.class);
|
||||
|
||||
@Source("prettify.css")
|
||||
CssResource css();
|
||||
CssResource prettify_css();
|
||||
|
||||
@Source("gerrit.css")
|
||||
PrettyCss css();
|
||||
|
||||
@Source("prettify.js")
|
||||
TextResource core();
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
.visualtab {
|
||||
border: 1px dotted red;
|
||||
}
|
||||
|
||||
.whitespaceerror {
|
||||
background: red;
|
||||
}
|
Loading…
Reference in New Issue