mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Wrap paragraphs in <p> tags
This commit is contained in:
parent
23c05ad7db
commit
6577efc8f4
1 changed files with 5 additions and 2 deletions
|
|
@ -17,7 +17,7 @@ def wp2fields(xml):
|
|||
from BeautifulSoup import BeautifulStoneSoup
|
||||
except ImportError:
|
||||
error = 'Missing dependency ' + \
|
||||
'"BeautifulSoup" required to import Wordpress files.'
|
||||
'"BeautifulSoup" required to import Wordpress XML files.'
|
||||
sys.exit(error)
|
||||
|
||||
xmlfile = open(xml, encoding='utf-8').read()
|
||||
|
|
@ -226,7 +226,10 @@ def fields2pelican(fields, out_markup, output_path, dircat=False):
|
|||
with open(html_filename, 'w', encoding='utf-8') as fp:
|
||||
# Replace simple newlines with <br />+newline so that the HTML file
|
||||
# represents the original post more accurately
|
||||
content = content.replace("\n", "<br />\n")
|
||||
paragraphs = content.split('\n\n')
|
||||
paragraphs = ['<p>%s</p>' % p for p in paragraphs]
|
||||
new_content = ''.join(paragraphs)
|
||||
|
||||
fp.write(content)
|
||||
|
||||
cmd = 'pandoc --normalize --reference-links --from=html --to={0} -o "{1}" "{2}"'.format(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue