Commit eb96f85c authored by Sebastian Pipping's avatar Sebastian Pipping

Reduce whitespace

git-svn-id: https://svn.xiph.org/websites/validator.xspf.org@15253 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent b66da98c
......@@ -123,7 +123,6 @@ print "Content-Type: text/html" # HTML is following
print # blank line, end of headers
# Get the basename of this script
# co = sys._getframe().f_code
# SELFBASE = co.co_filename
......@@ -251,7 +250,6 @@ print """
<!-- BORDER -->"""
valid = False
intro = ""
input = ""
......@@ -307,7 +305,6 @@ else:
+ "\" class=\"blackLink\">" + cgi.escape(url) + "</a></i></b><br><br>"
lineHeads = [0]
if input != "":
index = -1
......@@ -319,7 +316,6 @@ if input != "":
if input == "":
# Formular 600
print """
......@@ -333,7 +329,6 @@ print """
<tr>"""
if input == "":
# Formular centered
print """
......@@ -350,14 +345,12 @@ else:
<table style="width:100%;">"""
print """
<tr>
<td style="padding-bottom: 20px;" align="center"><img src="xspflogo-1.5.gif" style="width:297px; height:83px; border:0;" alt=""></td>
</tr>"""
if input == "":
if intro != "":
print """
......@@ -484,24 +477,20 @@ else:
checker = xml.parsers.expat.ParserCreate(None, SPIFF_NS_SEP_CHAR)
#############################################################################################
errorTable = ""
def nsXspf(localName):
return SPIFF_NS_HOME + SPIFF_NS_SEP_CHAR + localName
def nsXml(localName):
return XML_NS_HOME + SPIFF_NS_SEP_CHAR + localName
def startErrorTable():
if globals()["errorTable"] == "":
globals()["errorTable"] += """
......@@ -511,13 +500,11 @@ def startErrorTable():
<tr height="1"><td class="horz">&nbsp;</td><td class="horz">&nbsp;</td><td class="horz">&nbsp;</td><td class="horz">&nbsp;</td></tr>"""
# line is one-based
def addError(line, col, error):
globals()["errorTable"] += "<tr><td class=\"number\"><a href=\"#bad_" + str(line) + "\" class=\"number\">" + str(line) + "</a></td><td class=\"number\">" + str(col) + "</td><td class=\"vert\">&nbsp;</td><td class=\"error\">" + error + "</td></tr>"
def stopErrorTable():
if globals()["errorTable"] != "":
globals()["errorTable"] += """
......@@ -530,12 +517,10 @@ def stopErrorTable():
<br>"""
sourceTable = ""
lastLine = -1
def startSourceTable():
if globals()["sourceTable"] == "":
globals()["sourceTable"] = """
......@@ -543,7 +528,6 @@ def startSourceTable():
<table cellspacing="0">"""
def stopSourceTable():
startSourceTable()
......@@ -603,7 +587,6 @@ def moreSourceLinesIncluding(lineNumber, badFlag):
globals()["lastLine"] = lineNumber
def fail(text):
globals()["valid"] = False
......@@ -614,7 +597,6 @@ def fail(text):
moreSourceLinesIncluding(checker.CurrentLineNumber - 1, True)
def handlePlaylistAttribs(atts):
versionFound = False
......@@ -642,7 +624,6 @@ def handlePlaylistAttribs(atts):
fail("Attribute <i>version</i> missing.")
def handleNoAttribsExceptXmlBase(atts):
keys = atts.keys()
for i in range(len(atts)):
......@@ -655,7 +636,6 @@ def handleNoAttribsExceptXmlBase(atts):
fail("Attribute '" + keys[i] + "' not allowed.")
def handleExtensionAttribs(atts):
size = len(atts)
if size == 0:
......@@ -674,7 +654,6 @@ def handleExtensionAttribs(atts):
fail("Attribute '" + name + "' not allowed.")
def handleMetaLinkAttribs(atts):
size = len(atts)
if size == 0:
......@@ -693,7 +672,6 @@ def handleMetaLinkAttribs(atts):
fail("Attribute '" + name + "' not allowed.")
def handleStartOne(name, atts):
if name != nsXspf("playlist"):
# fail("Element '" + name + "' not allowed.")
......@@ -703,7 +681,6 @@ def handleStartOne(name, atts):
globals()["stack"].append(TAG_PLAYLIST)
def handleStartTwo(name, atts):
if name == nsXspf("annotation"):
if not globals()["firstPlaylistAnnotation"]:
......@@ -819,7 +796,6 @@ def handleStartTwo(name, atts):
globals()["skipAbove"] = 2
def handleStartThree(name, atts):
stackTop = globals()["stack"][len(globals()["stack"]) - 1]
if stackTop == TAG_PLAYLIST_ATTRIBUTION:
......@@ -859,7 +835,6 @@ def handleStartThree(name, atts):
globals()["skipAbove"] = 3
def handleStartFour(name, atts):
if name == nsXspf("album"):
if not globals()["firstTrackAlbum"]:
......@@ -957,7 +932,6 @@ def handleStartFour(name, atts):
globals()["skipAbove"] = 4
def handleStart(name, atts):
newLevel = len(globals()["stack"]) + 1
if (globals()["skipAbove"] != -1) and (newLevel > globals()["skipAbove"]):
......@@ -979,13 +953,11 @@ def handleStart(name, atts):
globals()["skipAbove"] = 4
def handleEndOne(name):
if globals()["firstPlaylistTrackList"]:
fail("Element <i>trackList</i> missing.")
def handleEndTwo(name):
stackTop = globals()["stack"][len(globals()["stack"]) - 1]
......@@ -1033,7 +1005,6 @@ def handleEndTwo(name):
globals()["accum"] = ""
def handleEndThree(name):
stackTop = globals()["stack"][len(globals()["stack"]) - 1]
......@@ -1066,7 +1037,6 @@ def handleEndThree(name):
globals()["accum"] = ""
def handleEndFour(name):
stackTop = globals()["stack"][len(globals()["stack"]) - 1]
......@@ -1115,7 +1085,6 @@ def handleEndFour(name):
globals()["accum"] = ""
def handleEnd(name):
level = len(globals()["stack"])
if globals()["skipAbove"] == level:
......@@ -1136,7 +1105,6 @@ def handleEnd(name):
globals()["stack"].pop()
def handleCharacters(s):
level = len(globals()["stack"])
if (globals()["skipAbove"] != -1) and (level > globals()["skipAbove"]):
......@@ -1169,12 +1137,10 @@ def handleCharacters(s):
globals()["accum"] += s
def isUri(text):
return Uri.MatchesUriRefSyntax(text)
def isDateTime(text):
match = globals()["dateRegex"].match(text)
if not match:
......@@ -1200,11 +1166,9 @@ def isDateTime(text):
return True
#############################################################################################
if input != "":
# Results
checker.StartElementHandler = handleStart
......@@ -1280,7 +1244,6 @@ if input != "":
print sourceTable
print """
</td>
</tr>
......@@ -1293,7 +1256,6 @@ else:
</form>"""
print """
</td>
</tr>
......@@ -1322,7 +1284,6 @@ print """
</html>"""
if shellMode:
if valid:
sys.exit(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment