@@ -192,7 +192,7 @@ def CodeBlockOpener(file_name):
192
192
return '```' + highlight_code
193
193
194
194
def AddCodeOutput (file_name , code , output ):
195
- output .append ('\n \n ## File name `%s` \n \n ' % file_name )
195
+ output .append ('\n \n ### File name %s \n \n ' % file_name )
196
196
output .append (CodeBlockOpener (file_name ))
197
197
output .append ('\n ' .join (code ))
198
198
output .append ('\n ```\n \n ' )
@@ -207,13 +207,17 @@ def ConvertTutorialToMarkdownText(test_file_path, test_file, other_files, revisi
207
207
the contents as for test_file.
208
208
"""
209
209
if revision :
210
- revision = ' at revision r' + str (revision )
210
+ revision_text = f' at revision [{ revision [:8 ]} ](https://github.com/Chaste/PyChaste/commit/{ revision } )'
211
+ else :
212
+ revision_text = ''
213
+
211
214
output = []
212
215
# Header
213
216
regex = re .compile (r'(?!^)(?=[A-Z])' , re .MULTILINE )
214
217
ugly_file_name = os .path .splitext (os .path .basename (test_file_path ))[0 ]
215
218
nice_file_name = re .sub (regex , " " , ugly_file_name )
216
219
220
+ link_path = f"https://github.com/Chaste/PyChaste/blob/develop/test/tutorials/{ ugly_file_name } .py"
217
221
page_header = f"""
218
222
---
219
223
title : "{ nice_file_name } "
@@ -224,10 +228,9 @@ def ConvertTutorialToMarkdownText(test_file_path, test_file, other_files, revisi
224
228
layout: "single"
225
229
---
226
230
227
- This tutorial is automatically generated from the file { test_file_path } { revision } .
231
+ This tutorial is automatically generated from [ { ugly_file_name } ]( { link_path } ) { revision_text } .
228
232
Note that the code is given in full at the bottom of the page.
229
233
230
-
231
234
"""
232
235
233
236
output .append (page_header )
@@ -244,7 +247,7 @@ def ConvertTutorialToMarkdownText(test_file_path, test_file, other_files, revisi
244
247
if file_code :
245
248
other_code [other_file [0 ]] = file_code
246
249
# Now output the C++ code for all files
247
- output .append ('\n \n # Code \n The full code is given below\n ' )
250
+ output .append ('\n \n ## Code \n The full code is given below\n ' )
248
251
AddCodeOutput (os .path .basename (test_file_path ), test_code , output )
249
252
for filename , code in other_code .items ():
250
253
AddCodeOutput (filename , code , output )
0 commit comments