Skip to content

Commit

Permalink
Wiki content conversions: Format as Unicode whenever possible
Browse files Browse the repository at this point in the history
Should help with #38.
  • Loading branch information
projectgus committed Dec 3, 2015
1 parent e5d59d1 commit 37570d3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions wikicontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def convert(url, context, trailing_newline):
text = convert_children(url, context).strip(" ")
url = url.caption
if len(text):
return "[[%s|%s]]" % (url, text)
return u"[[%s|%s]]" % (url, text)
else:
return "%s" % (url)
return u"%s" % (url)

@visitor.when(URL)
def convert(url, context, trailing_newline):
Expand Down Expand Up @@ -175,9 +175,9 @@ def convert(link, context, trailing_newline):
text = convert_children(link, context).strip(" ")
pagename = convert_internal_link(link.target)
if len(text):
return "[[%s|%s]]" % (pagename, text)
return u"[[%s|%s]]" % (pagename, text)
else:
return "[[%s]]" % pagename
return u"[[%s]]" % pagename

@visitor.when(CategoryLink)
def convert(link, context, trailing_newline):
Expand All @@ -190,9 +190,9 @@ def convert(link, context, trailing_newline):
filename = dokuwiki.make_dokuwiki_pagename(canonicalise_file_namespace(link.target))
caption = convert_children(link, context).strip()
if len(caption) > 0:
return "{{%s%s}}" % (filename, caption)
return u"{{%s%s}}" % (filename, caption)
else:
return "{{%s}}" % filename
return u"{{%s}}" % filename

print("WARNING: Ignoring namespace link to " + link.target)
return convert_children(link, context)
Expand All @@ -219,7 +219,7 @@ def convert(table, context, trailing_newline):
@visitor.when(Cell)
def convert(cell, context, trailing_newline):
marker = "^" if cell.tagname == "th" else "|"
result = "%s %s" % (marker, convert_children(cell, context).replace('\n','').strip())
result = u"%s %s" % (marker, convert_children(cell, context).replace('\n','').strip())
return result

@visitor.when(Row)
Expand Down

0 comments on commit 37570d3

Please sign in to comment.