@@ -1094,7 +1094,29 @@ def generate_assets(
10941094 f"Unable to extract some dynamic exercise substitutions: \n { e } "
10951095 )
10961096 log .debug (e , exc_info = True )
1097+ if "qrcode" in assets_to_generate :
1098+ log .warning ("Now generating QR codes" )
1099+ try :
1100+ # Warn if trying to generate qrcodes without a base URL.
1101+ base_url = self ._read_publication_file_subset ().baseurl
1102+ if base_url is None :
1103+ log .warning (
1104+ "You are trying to generate qrcodes, but the publication file does not have a base URL. "
1105+ + "This will result in qrcodes that do not point to anything meaningful."
1106+ )
1107+ core .qrcode (
1108+ xml_source = self .source_abspath (),
1109+ pub_file = self .publication_abspath ().as_posix (),
1110+ stringparams = stringparams_copy ,
1111+ xmlid_root = xmlid ,
1112+ dest_dir = self .generated_dir_abspath () / "qrcode" ,
1113+ )
1114+ successful_assets .append ("qrcode" )
1115+ except Exception as e :
1116+ log .error (f"Unable to generate some qrcodes:\n { e } " )
1117+ log .debug (e , exc_info = True )
10971118 if "latex-image" in assets_to_generate :
1119+ log .warning ("Now generating latex images" )
10981120 try :
10991121 for outformat in asset_formats ["latex-image" ]:
11001122 core .latex_image_conversion (
@@ -1208,26 +1230,6 @@ def generate_assets(
12081230 log .debug (e , exc_info = True )
12091231 # youtube also requires the play button.
12101232 self .ensure_play_button ()
1211- if "qrcode" in assets_to_generate :
1212- try :
1213- # Warn if trying to generate qrcodes without a base URL.
1214- base_url = self ._read_publication_file_subset ().baseurl
1215- if base_url is None :
1216- log .warning (
1217- "You are trying to generate qrcodes, but the publication file does not have a base URL. "
1218- + "This will result in qrcodes that do not point to anything meaningful."
1219- )
1220- core .qrcode (
1221- xml_source = self .source_abspath (),
1222- pub_file = self .publication_abspath ().as_posix (),
1223- stringparams = stringparams_copy ,
1224- xmlid_root = xmlid ,
1225- dest_dir = self .generated_dir_abspath () / "qrcode" ,
1226- )
1227- successful_assets .append ("qrcode" )
1228- except Exception as e :
1229- log .error (f"Unable to generate some qrcodes:\n { e } " )
1230- log .debug (e , exc_info = True )
12311233 if "mermaid" in assets_to_generate :
12321234 try :
12331235 for outformat in asset_formats ["mermaid" ]:
0 commit comments