Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve sphinxcontrib.email: AttributeError in python3 #11

Merged
merged 1 commit into from
Feb 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions email/sphinxcontrib/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
# a BSD license.

import re
import string

rot_13_trans = string.maketrans(
try:
maketrans = ''.maketrans
except AttributeError:
# fallback for Python 2
from string import maketrans

rot_13_trans = maketrans(
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
)
Expand Down Expand Up @@ -57,7 +62,6 @@ def email_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
"""
Role to obfuscate e-mail addresses.
"""
print 123456789, text, '\n\n'
text = text.decode('utf-8').encode('utf-8')
# Handle addresses of the form "Name <[email protected]>"
if '<' in text and '>' in text:
Expand All @@ -76,4 +80,3 @@ def email_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):

def setup(app):
app.add_role('email', email_role)