Only build tables for exporter docs

This commit is contained in:
JonnyWong16 2020-10-10 10:06:25 -07:00
parent dd45b47032
commit 276ea4dd98
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 4 additions and 17 deletions

View file

@ -2098,10 +2098,6 @@ def get_custom_fields(media_type, sub_media_type=None):
def build_export_docs(): def build_export_docs():
export = Export() export = Export()
contents_row = '* [{section}](#{anchor})'
contents_images = '\n\n### Image Exports:\n\n' \
'* [Image Exports](#image-export)\n\n---\n\n'
section_head = '### <a id="{anchor}">{section}</a>\n\n' section_head = '### <a id="{anchor}">{section}</a>\n\n'
section_details = '<details>\n' \ section_details = '<details>\n' \
'<summary><strong>{field_type} Fields</strong></summary><br>\n\n' \ '<summary><strong>{field_type} Fields</strong></summary><br>\n\n' \
@ -2141,9 +2137,6 @@ def build_export_docs():
else: else:
section_title = export.PLURAL_MEDIA_TYPES[media_type].capitalize() section_title = export.PLURAL_MEDIA_TYPES[media_type].capitalize()
contents_link = contents_row.format(anchor=media_type, section=section_title)
contents.append(contents_link)
details = [] details = []
table_child_rows = _child_rows(media_type) table_child_rows = _child_rows(media_type)
@ -2196,18 +2189,12 @@ def build_export_docs():
if media_type == 'collection': if media_type == 'collection':
section += '\n\n* **Note:** `children` can be [Movies](#movie) or [Shows](#show) ' \ section += '\n\n* **Note:** `children` can be [Movies](#movie) or [Shows](#show) ' \
'depending on the collection' 'depending on the collection.'
elif media_type == 'playlist': elif media_type == 'playlist':
section += '\n\n* **Note:** `items` can be [Movies](#movie), [Episodes](#episode), ' \ section += '\n\n* **Note:** `items` can be [Movies](#movie), [Episodes](#episode), ' \
'[Tracks](#track), or [Photos](#photo) depending on the playlist' '[Tracks](#track), or [Photos](#photo) depending on the playlist.'
sections.append(section) sections.append(section)
docs = '## Exporter Guide\n\n' \ docs = '\n\n---\n\n'.join(sections)
'### Media Type Fields:\n\n' + \
'\n'.join(contents) + \
contents_images + \
'\n\n---\n\n'.join(sections) + \
'\n\n---\n\n'
return helpers.sanitize(docs) return helpers.sanitize(docs)

View file

@ -6826,5 +6826,5 @@ class WebInterface(object):
@cherrypy.expose @cherrypy.expose
@requireAuth(member_of("admin")) @requireAuth(member_of("admin"))
def export_docs(self, **kwargs): def exporter_docs(self, **kwargs):
return '<pre>' + exporter.build_export_docs() + '</pre>' return '<pre>' + exporter.build_export_docs() + '</pre>'