@@ -190,14 +190,21 @@ def make_schema_page(self):
190
190
}
191
191
schema_assets_directory = os .path .join (self .static_assets_directory_path ,"schema" )
192
192
make_dir (schema_assets_directory )
193
+ references = {}
194
+ reference_counter = 1
195
+ reference_string = "\n "
193
196
for schema in self .lattice .schemas :
194
197
content = load (schema .json_schema_path )
195
198
output_path = os .path .join (schema_assets_directory , get_file_basename (schema .json_schema_path ))
196
199
shutil .copy (schema .json_schema_path , output_path )
197
- schema_files ["Schema" ].append (f"[{ content ['title' ]} ](/{ self .git_repo_name } /{ os .path .relpath (output_path , self .static_directory_path )} )" )
200
+ references [reference_counter ] = f"/{ self .git_repo_name } /{ os .path .relpath (output_path , self .static_directory_path )} "
201
+ schema_files ["Schema" ].append (f"[{ content ['title' ]} ][{ reference_counter } ]" )
202
+ reference_string += f"\n [{ reference_counter } ]: { references [reference_counter ]} "
203
+ reference_counter += 1
198
204
schema_files ["Description" ].append (content ["description" ])
199
205
200
- self .make_main_menu_page (self .schema_directory_path ,"Schema" ,content = write_table (schema_files ,["Schema" ,"Description" ]))
206
+ content = "# JSON Schema\n \n " + write_table (schema_files ,["Schema" ,"Description" ]) + reference_string + "\n "
207
+ self .make_main_menu_page (self .schema_directory_path ,"Schema" ,content = content )
201
208
202
209
def make_examples_page (self ):
203
210
example_files = {
@@ -207,21 +214,29 @@ def make_examples_page(self):
207
214
}
208
215
example_assets_directory = os .path .join (self .static_assets_directory_path ,"examples" )
209
216
make_dir (example_assets_directory )
217
+ references = {}
218
+ reference_counter = 1
219
+ reference_string = "\n "
210
220
for example in self .lattice .examples :
211
221
content = load (example )
212
222
file_base_name = get_file_basename (example , depth = 1 )
213
- formats = ['json ' , 'yaml ' , 'cbor' ]
223
+ formats = ['yaml ' , 'json ' , 'cbor' ]
214
224
output_path = {}
215
225
web_links = {}
216
226
for format in formats :
217
227
output_path [format ] = os .path .join (example_assets_directory , f"{ file_base_name } .{ format } " )
218
- web_links [format ] = f"[{ format .upper ()} ](/{ self .git_repo_name } /{ os .path .relpath (output_path [format ], self .static_directory_path )} )"
228
+ references [reference_counter ] = f"/{ self .git_repo_name } /{ os .path .relpath (output_path [format ], self .static_directory_path )} "
229
+ web_links [format ] = f"[{ format .upper ()} ][{ reference_counter } ]"
230
+ reference_string += f"\n [{ reference_counter } ]: { references [reference_counter ]} "
231
+ reference_counter += 1
219
232
translate (example , output_path [format ])
220
233
example_files ["File Name" ].append (file_base_name )
221
234
example_files ["Description" ].append (content ["metadata" ]["description" ])
222
235
example_files ["Download" ].append (f"{ web_links ['yaml' ]} { web_links ['json' ]} { web_links ['cbor' ]} " )
223
236
224
- self .make_main_menu_page (self .examples_directory_path ,"Examples" ,content = write_table (example_files ,["File Name" ,"Description" ,"Download" ]))
237
+
238
+ content = "# Example Files\n \n " + write_table (example_files ,["File Name" ,"Description" ,"Download" ]) + reference_string + "\n "
239
+ self .make_main_menu_page (self .examples_directory_path ,"Examples" ,content = content )
225
240
226
241
def make_page (self , page_path , front_matter , content = "" ):
227
242
with open (page_path ,'w' ) as file :
0 commit comments