Skip to content

Commit

Permalink
Minor tweak to visualisation of categories in preview mode (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
lokal-profil authored May 12, 2017
1 parent 2be8ac6 commit 9a75243
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion batchupload/make_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def make_info_page(data, preview=False):
text = 'Filename: {filename}.<ext>\n{template}{cats}'.format(
filename=data['filename'],
template=data['info'],
cats=cats_as_text.replace('[[Category:', '[[:Category:'))
cats=cats_as_text.replace('[[Category:', '* [[:Category:')
.replace('<!-- ', "''")
.replace(' -->', ":''"))
else:
text = '{template}{cats}'.format(
template=data['info'],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from setuptools import setup
version = '0.1.3'
version = '0.1.4'
repo = 'BatchUploadTools'

setup(
Expand Down
16 changes: 8 additions & 8 deletions tests/test_make_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def test_make_info_page(self):

def test_make_info_page_preview(self):
expected = (
'Filename: The_filename.<ext>\n'
'{{Infobox\n| param1 = value1 \n}}\n\n'
'<!-- Metadata categories -->\n'
'[[:Category:A meta_Cat]]\n'
'\n\n'
'<!-- Content categories -->\n'
'[[:Category:cat1]]\n'
'[[:Category:cat2]]')
"Filename: The_filename.<ext>\n"
"{{Infobox\n| param1 = value1 \n}}\n\n"
"''Metadata categories:''\n"
"* [[:Category:A meta_Cat]]\n"
"\n\n"
"''Content categories:''\n"
"* [[:Category:cat1]]\n"
"* [[:Category:cat2]]")
self.assertEqual(
make_info_page(self.data, preview=True),
expected)
Expand Down

0 comments on commit 9a75243

Please sign in to comment.