camlspotter avatar camlspotter committed f9d5733

update

Comments (0)

Files changed (1)

extensions/confluenceWriter.py

         self.level = level
 
     def to_string(self, indent):
-        return '*' * self.level + ' ' + Block.try_inline_internal(self)
+        line = 'h' + str(self.level) + '. ' + Block.try_inline_internal(self)
+        if self.is_first_item(): # does not work ?
+            return '\n' + line
+        else:
+            return '\n' + line
 
 class Par(Block):
     def __init__(self, parent):
 
     def to_string(self, indent):
         if self.is_first_item():
-            return 'P ' + Block.to_string(self, indent) + ' /P'
+            return Block.to_string(self, indent)
         else:
-            return ' ' * indent + '<p>\n' + Block.to_string(self, indent)
+            return '\n' + Block.to_string(self, indent)
 
     def try_inline(self):
         if self.is_first_item():
         except InlineFailure:
             return ' ' * indent + '<' + self.tag() + '>\n' + Block.to_string(self, indent+2) + '\n' + ' ' * indent + '</' + self.tag() + '>' 
 
-class LItem(HTML):
-    def __init__(self, parent):
-        HTML.__init__(self, parent, '?LITEM?')
-        self.dict = {'ul':'li',
-                     'ol':'oi'}
-        
-    def tag(self):
-        if self.parent.tag:
-            return self.dict.get(self.parent.tag, '?' + self.parent.tag()) 
-        else:
-            return "?LITEM?"
+class LItem(Block):
+    def __init__(self, parent, listlevels):
+        Block.__init__(self, parent)
+        self.listlevels = listlevels
+
+    def to_string(self, indent):
+        return str(self.listlevels) + ' ' + Block.to_string(self, 0)
 
 class LiteralBlock(Block):
     def __init__(self, parent, lang):
         self.contents.extend(elem.split('\n'))
 
     def to_string(self, indent):
-        return '>|' + self.lang + '|\n' + Block.to_string(self, 0) + '\n||<'
+        return '{code}' + '\n' + Block.to_string(self, 0) + '\n{code}'
 
 class Verbose(Block):
     def __init__(self, parent, name):
         self.sectionlevel = 0
         self.highlightlang = ''
 
+        self.listlevels = ''
+
     def add_text(self, text):
         self.block.append(text)
 
 #        self.end_state()
 #        raise nodes.SkipNode
 
+            
     def visit_bullet_list(self, node):
-        self.new_block(HTML, 'ul')
+        self.listlevels = self.listlevels + '*'
     def depart_bullet_list(self, node):
-        self.end_block()
+        self.listlevels = self.listlevels[0:-1]
 
-#    def visit_enumerated_list(self, node):
-#        self.list_counter.append(0)
-#    def depart_enumerated_list(self, node):
-#        self.list_counter.pop()
+    def visit_enumerated_list(self, node):
+        self.listlevels = self.listlevels + '#'
+    def depart_enumerated_list(self, node):
+        self.listlevels = self.listlevels[0:-1]
 
+    # Hehehe, our confluence is too old and does not support {html}
     def visit_definition_list(self, node):
-        self.new_block(HTML, 'dl')
+        self.listlevels = self.listlevels + '*'
     def depart_definition_list(self, node):
-        self.end_block()
+        self.listlevels = self.listlevels[0:-1]
 
     def visit_list_item(self, node):
-        self.new_block(LItem)
+        self.new_block(LItem, self.listlevels)
     def depart_list_item(self, node):
         self.end_block()
 
         pass
 
     def visit_term(self, node):
-        self.new_block(HTML, 'dt')
+        self.new_block(LItem, self.listlevels)
     def depart_term(self, node):
         self.end_block()
 
 #        self.end_state(end=None)
 
     def visit_definition(self, node):
-        self.new_block(HTML, 'dd')
+        self.listlevels = self.listlevels + '*'
+        self.new_block(LItem, self.listlevels)
     def depart_definition(self, node):
         self.end_block()
+        self.listlevels = self.listlevels[0:-1]
 
 #    def visit_field_list(self, node):
 #        pass
 #        pass
 
     def visit_emphasis(self, node):
-        self.add_text('<it>')
+        self.add_text('_')
     def depart_emphasis(self, node):
-        self.add_text('</it>')
+        self.add_text('_')
 
 #    def visit_literal_emphasis(self, node):
 #        self.add_text('<it>')
 #        self.add_text('</it>')
 
     def visit_strong(self, node):
-        self.add_text('<b>')
+        self.add_text('*')
     def depart_strong(self, node):
-        self.add_text('</b>')
+        self.add_text('*')
 
 #    def visit_abbreviation(self, node):
 #        self.add_text('')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.