summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorklm1998-04-09 00:01:27 +0000
committerklm1998-04-09 00:01:27 +0000
commit303f925eba07686cdb90136725213c58c399e6b9 (patch)
tree3767c8638dadb0fc506eea72456a60ebbe9974e7
parente887885d025332998a5d271bb5addfefe8b3b22a (diff)
downloadmailman-303f925eba07686cdb90136725213c58c399e6b9.tar.gz
mailman-303f925eba07686cdb90136725213c58c399e6b9.tar.zst
mailman-303f925eba07686cdb90136725213c58c399e6b9.zip
-rw-r--r--Mailman/htmlformat.py19
-rw-r--r--modules/htmlformat.py19
2 files changed, 22 insertions, 16 deletions
diff --git a/Mailman/htmlformat.py b/Mailman/htmlformat.py
index 698ef04f2..72a6a53b9 100644
--- a/Mailman/htmlformat.py
+++ b/Mailman/htmlformat.py
@@ -175,14 +175,18 @@ class Table:
class Link:
- def __init__(self, target, text):
- self.target = target
+ def __init__(self, href, text, target=None):
+ self.href = href
self.text = text
+ self.target = target
def Format(self, indent=0):
- return '<a href="%s">%s</a>' % (HTMLFormatObject(self.target, indent),
- HTMLFormatObject(self.text, indent))
-
+ texpr = ""
+ if self.target != None:
+ texpr = ' target="%s"' % self.target
+ return '<a href="%s"%s>%s</a>' % (HTMLFormatObject(self.href, indent),
+ texpr,
+ HTMLFormatObject(self.text, indent))
class FontSize:
"""FontSize is being deprecated - use FontAttr(..., size="...") instead."""
@@ -214,7 +218,6 @@ class FontAttr:
return output
-
class Container:
def __init__(self, *items):
if not items:
@@ -244,11 +247,11 @@ class Document(Container):
output = 'Content-type: text/html\n\n'
spaces = ' ' * indent
output = output + spaces
- output = output + '<html>\n'
+ output = output + '<html>\n<head>\n'
if self.title:
output = '%s%s<TITLE>%s</TITLE>\n' % (output, spaces,
self.title)
- output = '%s%s</html>\n%s<body' % (output, spaces, spaces)
+ output = '%s%s</head>\n%s<body' % (output, spaces, spaces)
quals = []
for k, v in kw.items():
quals.append('%s="%s"' % (k, v))
diff --git a/modules/htmlformat.py b/modules/htmlformat.py
index 698ef04f2..72a6a53b9 100644
--- a/modules/htmlformat.py
+++ b/modules/htmlformat.py
@@ -175,14 +175,18 @@ class Table:
class Link:
- def __init__(self, target, text):
- self.target = target
+ def __init__(self, href, text, target=None):
+ self.href = href
self.text = text
+ self.target = target
def Format(self, indent=0):
- return '<a href="%s">%s</a>' % (HTMLFormatObject(self.target, indent),
- HTMLFormatObject(self.text, indent))
-
+ texpr = ""
+ if self.target != None:
+ texpr = ' target="%s"' % self.target
+ return '<a href="%s"%s>%s</a>' % (HTMLFormatObject(self.href, indent),
+ texpr,
+ HTMLFormatObject(self.text, indent))
class FontSize:
"""FontSize is being deprecated - use FontAttr(..., size="...") instead."""
@@ -214,7 +218,6 @@ class FontAttr:
return output
-
class Container:
def __init__(self, *items):
if not items:
@@ -244,11 +247,11 @@ class Document(Container):
output = 'Content-type: text/html\n\n'
spaces = ' ' * indent
output = output + spaces
- output = output + '<html>\n'
+ output = output + '<html>\n<head>\n'
if self.title:
output = '%s%s<TITLE>%s</TITLE>\n' % (output, spaces,
self.title)
- output = '%s%s</html>\n%s<body' % (output, spaces, spaces)
+ output = '%s%s</head>\n%s<body' % (output, spaces, spaces)
quals = []
for k, v in kw.items():
quals.append('%s="%s"' % (k, v))