27
27
RunestoneIdDirective ,
28
28
RunestoneIdNode ,
29
29
)
30
+ import pdb
30
31
31
32
32
33
def setup (app ):
@@ -38,7 +39,7 @@ def setup(app):
38
39
app .connect ("env-purge-doc" , purge_datafiles )
39
40
40
41
41
- TEMPLATE = u """
42
+ TEMPLATE = """
42
43
<div class="runestone datafile %(optclass)s">
43
44
<div class="datafile_caption">Data file: <code>%(divid)s</code></div>
44
45
<pre data-component="datafile" id=%(divid)s %(hidden)s data-edit="%(edit)s" data-rows="%(rows)s" data-cols="%(cols)s">
@@ -55,6 +56,7 @@ def setup(app):
55
56
class DataFileNode (nodes .General , nodes .Element , RunestoneIdNode ):
56
57
pass
57
58
59
+
58
60
# self for these functions is an instance of the writer class. For example
59
61
# in html, self is sphinx.writers.html.SmartyPantsHTMLTranslator
60
62
# The node that is passed as a parameter is an instance of our node class.
@@ -74,9 +76,9 @@ def visit_df_html(self, node):
74
76
75
77
76
78
def depart_df_html (self , node ):
77
- """ This is called at the start of processing an datafile node. If datafile had recursive nodes
78
- etc and did not want to do all of the processing in visit_ac_html any finishing touches could be
79
- added here.
79
+ """This is called at the start of processing an datafile node. If datafile had recursive nodes
80
+ etc and did not want to do all of the processing in visit_ac_html any finishing touches could be
81
+ added here.
80
82
"""
81
83
pass
82
84
@@ -91,14 +93,14 @@ def purge_datafiles(app, env, docname):
91
93
92
94
class DataFile (RunestoneIdDirective ):
93
95
"""
94
- .. datafile:: identifier
95
- :edit: Option that makes the datafile editable
96
- :cols: If editable, number of columns--default is 20
97
- :rows: If editable, number of rows--default is 40
98
- :hide: Flag that sets a non-editable datafile to be hidden
99
- :image: Flag that says this file is an image implies :fromfile: will be used
100
- :fromfile: path to file that contains the data
101
- """
96
+ .. datafile:: identifier
97
+ :edit: Option that makes the datafile editable
98
+ :cols: If editable, number of columns--default is 20
99
+ :rows: If editable, number of rows--default is 40
100
+ :hide: Flag that sets a non-editable datafile to be hidden
101
+ :image: Flag that says this file is an image implies :fromfile: will be used
102
+ :fromfile: path to file that contains the data
103
+ """
102
104
103
105
required_arguments = 1
104
106
optional_arguments = 0
@@ -117,16 +119,16 @@ class DataFile(RunestoneIdDirective):
117
119
118
120
def run (self ):
119
121
"""
120
- process the multiplechoice directive and generate html for output.
121
- :param self:
122
- :return:
123
- .. datafile:: identifier
124
- :edit: Option that makes the datafile editable
125
- :cols: If editable, number of columns--default is 20
126
- :rows: If editable, number of rows--default is 40
127
- :hide: Flag that sets a non-editable datafile to be hidden
128
- :image:
129
- :fromfile: path to file that contains the data
122
+ process the multiplechoice directive and generate html for output.
123
+ :param self:
124
+ :return:
125
+ .. datafile:: identifier
126
+ :edit: Option that makes the datafile editable
127
+ :cols: If editable, number of columns--default is 20
128
+ :rows: If editable, number of rows--default is 40
129
+ :hide: Flag that sets a non-editable datafile to be hidden
130
+ :image:
131
+ :fromfile: path to file that contains the data
130
132
"""
131
133
super (DataFile , self ).run ()
132
134
env = self .state .document .settings .env
0 commit comments