Skip to content
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
15 changes: 9 additions & 6 deletions _scripts/tutorialformatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

# BEGIN_SUB_TUTORIAL callbackFunction
def callback():
print "in callback"
print("in callback")
# END_SUB_TUTORIAL

# BEGIN_TUTORIAL
Expand All @@ -70,6 +70,9 @@ def callback():
# 0.1.1: fixed a bug in source file directory lookup: now source paths are
# relative to the directory in which the including document lives.
# 0.1.2: Added SUB_TUTORIAL support.

from __future__ import print_function

__version__ = '0.1.2'

import os
Expand Down Expand Up @@ -118,7 +121,7 @@ def flatten_sub_tutorials(self, file_):
if sub_name in subs:
flattened_lines.extend( subs[sub_name] )
else:
print 'tutorialformatter.py error: sub-tutorial %s not found.' % sub_name
print('tutorialformatter.py error: sub-tutorial %s not found.' % sub_name)
else:
flattened_lines.append( line )
return flattened_lines
Expand All @@ -144,7 +147,7 @@ def run(self):
code_prefix = '\n.. code-block:: ' + language + '\n\n'
code_suffix = '\n'

print "tutorial-formatter running on", absfilename
print("tutorial-formatter running on " + absfilename)
file_ = open( absfilename, 'r' )
text_to_process = ""
current_block = ""
Expand Down Expand Up @@ -187,9 +190,9 @@ def run(self):
text_to_process += current_block

# Debug writes...
# print 'text_to_process ='
# print text_to_process
# print '= text_to_process'
# print('text_to_process =')
# print(text_to_process)
# print('= text_to_process')

lines = string2lines( text_to_process )
self.state_machine.insert_input( lines, absfilename )
Expand Down