1.1 --- a/TO_DO.txt Tue Apr 09 17:04:09 2013 +0200
1.2 +++ b/TO_DO.txt Wed Apr 10 00:59:29 2013 +0200
1.3 @@ -1,6 +1,7 @@
1.4 DOC/Do you offer Mailman hosting%2C consulting%2C or contractor services%3F (4030519)
1.5
1.6 - Links to other spaces need fixing in the XHTML format
1.7 + (Links to other spaces need fixing in the XHTML format)
1.8 + Other link styles might be lurking elsewhere
1.9
1.10 Handle page renaming (add redirects, perhaps support comments on old revisions):
1.11
1.12 @@ -11,6 +12,10 @@
1.13
1.14 file: causes a link to be created
1.15
1.16 +DOC/I've set up Mailman%2C created a list%2C and added myself to the list%2C but I don't get any messages! (4030512)
1.17 +
1.18 + @ in the text causes mailto: auto-linking
1.19 +
1.20 DOC/Email commands quick reference (786484)
1.21
1.22 Nested sections need to have increased bracketing for outer markers
1.23 @@ -34,6 +39,11 @@
1.24
1.25 Table formatting in section 9.1 (also incorrect in the Confluence markup version)
1.26
1.27 +COM/Mailman consulting services (4489296)
1.28 +
1.29 + Improperly terminated link: http://www.linagora.com<<BR>>
1.30 + Need to separate URLs from surrounding text
1.31 +
1.32 Make redirect pages so that COM redirects to COM/Home, and so on.
1.33
1.34 Comment ownership and presentation.
2.1 --- a/xmlparser.py Tue Apr 09 17:04:09 2013 +0200
2.2 +++ b/xmlparser.py Wed Apr 10 00:59:29 2013 +0200
2.3 @@ -81,12 +81,20 @@
2.4 formatted_tags = ["ac:rich-text-body", "table"]
2.5
2.6 link_target_tags = {
2.7 - # Confluence element Attribute providing the target
2.8 - "ri:page" : "ri:content-title",
2.9 - "ri:attachment" : "ri:filename",
2.10 - "ri:user" : "ri:username",
2.11 + # Confluence element Attributes providing the target
2.12 + "ri:page" : ("ri:space-key", "ri:content-title"),
2.13 + "ri:attachment" : ("ri:filename",),
2.14 + "ri:user" : ("ri:username",),
2.15 }
2.16
2.17 +link_target_prefixes = {
2.18 + # Attribute with details Prefix ensuring correct relative link
2.19 + "ri:space-key" : "..",
2.20 + "ri:content-title" : "..",
2.21 + }
2.22 +
2.23 +link_label_attributes = "ri:content-title", "ac:link-body"
2.24 +
2.25 # NOTE: User links should support the intended user namespace prefix.
2.26
2.27 link_target_types = {
2.28 @@ -143,10 +151,20 @@
2.29 # ContentHandler-related methods.
2.30
2.31 def startElement(self, name, attrs):
2.32 +
2.33 + # Track indentation for lists.
2.34 +
2.35 if list_tags.has_key(name):
2.36 self.indent += 1
2.37 +
2.38 + # Track element nesting.
2.39 +
2.40 elif self.states.has_key(name):
2.41 self.states[name] += 1
2.42 +
2.43 + # Track cumulative element nesting in order to produce appropriate depth
2.44 + # indicators in the formatted output.
2.45 +
2.46 if name in preformatted_tags or name in formatted_tags:
2.47 self.level += 1
2.48 self.max_level = max(self.level, self.max_level)
2.49 @@ -212,14 +230,31 @@
2.50 # Remember link target information.
2.51
2.52 elif link_target_tags.has_key(name):
2.53 - self.target = self.attributes[-1].get(link_target_tags[name])
2.54 + target_details = []
2.55 +
2.56 + # Get target details from the element's attributes.
2.57 +
2.58 + for attrname in link_target_tags[name]:
2.59 + attrvalue = self.attributes[-1].get(attrname)
2.60 + if attrvalue:
2.61 + target_details.append(attrvalue)
2.62 + prefix = link_target_prefixes.get(attrname)
2.63 + if prefix:
2.64 + target_details.insert(0, prefix)
2.65 + if attrname in link_label_attributes and not self.label:
2.66 + self.label = attrvalue
2.67 +
2.68 + # Make a link based on the details.
2.69 +
2.70 + self.target = "/".join(target_details)
2.71 self.target_type = name
2.72 text = ""
2.73
2.74 # For anchor links, just use the raw text and let Moin do the formatting.
2.75
2.76 elif name == "ac:link-body":
2.77 - self.target_type = name
2.78 + if not self.target_type:
2.79 + self.target_type = name
2.80 self.label = text
2.81 text = ""
2.82
2.83 @@ -276,7 +311,7 @@
2.84 # Links require target information.
2.85
2.86 if name in ("ac:link", "ac:image"):
2.87 - prefix = link_target_types.get(self.target_type, "../")
2.88 + prefix = link_target_types.get(self.target_type, "")
2.89 anchor = self.attributes[-1].get("ac:anchor")
2.90 text = conversion % (prefix, anchor or self.target, self.label or text or self.target)
2.91 self.target = self.target_type = self.label = None