Fix building asciidoc headers in importer & add docs

This commit is contained in:
Justin Mayer 2020-04-16 08:01:10 +02:00
commit 86ff02541f
2 changed files with 5 additions and 6 deletions

View file

@ -74,8 +74,8 @@ Optional arguments
-o OUTPUT, --output OUTPUT -o OUTPUT, --output OUTPUT
Output path (default: content) Output path (default: content)
-m MARKUP, --markup MARKUP -m MARKUP, --markup MARKUP
Output markup format (supports rst & markdown) Output markup format: ``rst``, ``markdown``, or ``asciidoc``
(default: rst) (default: ``rst``)
--dir-cat Put files in directories with categories name --dir-cat Put files in directories with categories name
(default: False) (default: False)
--dir-page Put files recognised as pages in "pages/" sub- --dir-page Put files recognised as pages in "pages/" sub-

View file

@ -571,12 +571,11 @@ def build_header(title, date, author, categories, tags, slug,
header += '\n' header += '\n'
return header return header
def build_asciidoc_header(title, date, author, categories, tags, slug, def build_asciidoc_header(title, date, author, categories, tags, slug,
status=None, attachments=None): status=None, attachments=None):
"""Build a header from a list of fields""" """Build a header from a list of fields"""
from docutils.utils import column_width
header = '= %s\n' % title header = '= %s\n' % title
if author: if author:
header += '%s\n' % author header += '%s\n' % author
@ -802,7 +801,7 @@ def fields2pelican(
ext = get_ext(out_markup, in_markup) ext = get_ext(out_markup, in_markup)
if ext == '.adoc': if ext == '.adoc':
header = build_asciidoc_header(title, date, author, categories, header = build_asciidoc_header(title, date, author, categories,
tags, slug, status, attached_files) tags, slug, status, attachments)
elif ext == '.md': elif ext == '.md':
header = build_markdown_header( header = build_markdown_header(
title, date, author, categories, tags, slug, title, date, author, categories, tags, slug,