self.depth = None
self.non_diff_root_descendants = 0
+ def has_ancestor_or_self(self, ancestor):
+ cursor = self
+ while cursor != None:
+ if cursor == ancestor:
+ return True
+ cursor = cursor.parent
+ return False
+
def is_diff_root(self):
return self.parent == None or self.is_patch
out.append(' .empty-topic {opacity: 0.5;}')
out.append(' .alt-content {display:none;}')
out.append(' :target.alt-content {display:block;}')
- out.append(' .message-block-container {border: 1px solid black;}')
+ out.append(' .message-block-container {border: 1px solid black; margin-left: 4em; margin-top: 3px; margin-bottom: 3px;}')
out.append(' .message-block-meta {font-style: italic; font-weight: bolder;}')
out.append(' .message-block-content {white-space: pre;}')
out.append(' </style>')
out.append('lore.kernel.org returned '+str(http_resp.status)+' '+html.escape(http_resp.reason, quote=False))
else:
response_body = http_resp.read()
- out.append('lore.kernel.org returned '+str(len(response_body))+' bytes<br>')
+ #out.append('lore.kernel.org returned '+str(len(response_body))+' bytes<br>')
response_body = gzip.decompress(response_body)
- out.append('decompresses to '+str(len(response_body))+' bytes<br>')
+ #out.append('decompresses to '+str(len(response_body))+' bytes<br>')
# hack...
global mbox_data_index
out.append(' <div class="alt-content" id="topic-'+str(topic_root.index)+'">')
printed_top_header = False
printed_threads_header = False
+ open_message_stack = []
for block in topic_root.blocks.ranges:
+ while len(open_message_stack) != 0 and not block.message.has_ancestor_or_self(open_message_stack[-1]):
+ open_message_stack.pop()
+ out.append(' </div>')
if block.start_pos_child < 0 and not printed_top_header:
out.append(' <h1>Top-posted messages (sorry this section looks like a mess)</h1>')
printed_top_header = True
if block.start_pos_child >= 0 and not printed_threads_header:
out.append(' <h1>Actual thread</h1>')
printed_threads_header = True
- out.append(' <div class="message-block-container" style="margin-left:'+str(block.message.depth*4)+'em">')
- out.append(' <div class="message-block-meta">'+html.escape(block.message.from_hdr, quote=False)+'</div>')
+ if len(open_message_stack) == 0 or block.message != open_message_stack[-1]:
+ open_message_stack.append(block.message)
+ out.append(' <div class="message-block-container">')
+ out.append(' <div class="message-block-meta">'+html.escape(block.message.from_hdr, quote=False)+'</div>')
out.append(' <div class="message-block-content">'+html.escape(block.get_text(), quote=False)+'</div>')
+ while len(open_message_stack) != 0:
+ open_message_stack.pop()
out.append(' </div>')
out.append(' </div>')
out.append(' </div>')