From b11ad48934ead29ba421216f83be32cc8cb6e373 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 1 Apr 2018 06:57:26 +0000 Subject: md_tw.py: Update TWMarkdown.output_list_item. * md_tw.py (TWMarkdown.output_list_item): Update method. * tests/data/renderer-lists-w.md: Update file. * tests/data/renderer-lists.md: Update file. --- md_tw.py | 5 +++-- tests/data/renderer-lists-w.md | 23 +++++++++++++++++++++++ tests/data/renderer-lists.md | 22 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/md_tw.py b/md_tw.py index c144eae..9f0c720 100644 --- a/md_tw.py +++ b/md_tw.py @@ -415,10 +415,10 @@ class TWMarkdown(mistune.Markdown): if self.token['type'] == 'text': txt = self.renderer.tw_fill(self.tok_text()) else: - txt = self.tok() + txt = '\n' + self.tok() if rm_i_indent: - txt = txt.lstrip() + txt = txt.lstrip(self.renderer.tw_get('initial_indent')) # Don't remove initial indent after processing first item. rm_i_indent = False @@ -440,6 +440,7 @@ class TWMarkdown(mistune.Markdown): # Process list item while self.pop()['type'] != 'list_item_end': body += process() + body = body.rstrip() # Render list item rendered_li = self.renderer.list_item(body) diff --git a/tests/data/renderer-lists-w.md b/tests/data/renderer-lists-w.md index e0f3eba..eff38f9 100644 --- a/tests/data/renderer-lists-w.md +++ b/tests/data/renderer-lists-w.md @@ -61,3 +61,26 @@ Aliquam hendrerit mi posuere lectus. $ :(){:|:&};: + + +And finally some snafu from daringfirball.net + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) diff --git a/tests/data/renderer-lists.md b/tests/data/renderer-lists.md index 2a9a0dd..f63cc8d 100644 --- a/tests/data/renderer-lists.md +++ b/tests/data/renderer-lists.md @@ -64,3 +64,25 @@ sit amet, consectetuer adipiscing elit. elit. Aliquam hendrerit mi posuere lectus. $ :(){:|:&};: + +And finally some snafu from daringfirball.net + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) -- cgit v1.2.3