@@ -98,6 +98,49 @@ def section_numbers(sec_title: str):
9898 'metaprog_part' : 'V—Metaprogramação' ,
9999}
100100
101+ SHORTENER_OUTPUT = '''
102+ + /4q https://pythonfluente.com/2/#ch_ifaces_prot_abc
103+ + /4r https://pythonfluente.com/2/#ch_op_overload
104+ + /4s https://pythonfluente.com/2/#ch_generators
105+ + /4t https://pythonfluente.com/2/#ch_seq_methods
106+ = /22 https://pythonfluente.com/2/#pattern_matching_case_study_sec
107+ + /4v https://pythonfluente.com/2/#classes_protocols_part
108+ + /4w https://pythonfluente.com/2/#how_slicing_works_sec
109+ + /4x https://pythonfluente.com/2/#sliceable_sequence_sec
110+ = /25 https://pythonfluente.com/2/#virtual_subclass_sec
111+ + /4y https://pythonfluente.com/2/#lispy_environ_sec
112+ + /4z https://pythonfluente.com/2/#subclass_builtin_woes_sec
113+ + /52 https://pythonfluente.com/2/#slots_sec
114+ = /29 https://pythonfluente.com/2/#typeddict_sec
115+ + /53 https://pythonfluente.com/2/#ch_class_metaprog
116+ = /2a https://pythonfluente.com/2/#problems_annot_runtime_sec
117+ + /54 https://pythonfluente.com/2/#ch_more_types
118+ + /55 https://pythonfluente.com/2/#ch_descriptors
119+ + /56 https://pythonfluente.com/2/#ch_inheritance
120+ = /2c https://pythonfluente.com/2/#positional_pattern_implement_sec
121+ + /57 https://pythonfluente.com/2/#ch_async
122+ + /58 https://pythonfluente.com/2/#runtime_annot_sec
123+ + /59 https://pythonfluente.com/2/#multi_hashing_sec
124+ + /5a https://pythonfluente.com/2/#iterable_reducing_sec
125+ + /5b https://pythonfluente.com/2/#flexible_new_sec
126+ + /5c https://pythonfluente.com/2/#ch_closure_decorator
127+ + /5d https://pythonfluente.com/2/#ch_design_patterns
128+ + /5e https://pythonfluente.com/2/#lispy_parser_sec
129+ + /5f https://pythonfluente.com/2/#overload_sec
130+ + /5g https://pythonfluente.com/2/#numbers_abc_proto_sec
131+ + /5h https://pythonfluente.com/2/#runtime_checkable_proto_sec
132+ + /5j https://pythonfluente.com/2/#variance_sec
133+ + /5k https://pythonfluente.com/2/#generic_iterable_types_sec
134+ + /5m https://pythonfluente.com/2/#typed_double_sec
135+ + /5n https://pythonfluente.com/2/#enhancing_with_init_subclass_sec
136+ + /5p https://pythonfluente.com/2/#more_type_hints_further_sec
137+ + /5q https://pythonfluente.com/2/#max_overload_sec
138+ '''
139+
140+ SHORT_URLS = {line .split ()[2 ]:line .split ()[1 ] for line
141+ in SHORTENER_OUTPUT .strip ().split ('\n ' )}
142+
143+
101144def replace_xrefs_to_vols ():
102145 html_path = find_git_root () / 'online/index.html'
103146 with open (html_path ) as fp :
@@ -121,7 +164,8 @@ def replace_xrefs_to_vols():
121164 else :
122165 raise ValueError (f'unexpected xref: { xref !r} ' )
123166 link = BASE_URL + '#' + xref
124- print (f'<<{ xref } >>' , f'{ text } [vol.{ volume } , { link } ]' )
167+ print (f'<<{ xref } >>' , f'{ text } [vol.{ volume } , fpy.li{ SHORT_URLS [link ]} ]' )
168+
125169
126170if __name__ == '__main__' :
127171 replace_xrefs_to_vols ()
0 commit comments