File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 33"""Build HTML from reST files."""
44
55from glob import glob
6- from os . path import splitext
6+ from pathlib import Path
77
88from docutils .core import publish_file
99
1010print ("Creating the documentation..." )
1111
1212for rst_file in glob ('*.rst' ):
13- name = splitext (rst_file )[0 ]
14- lang = splitext (name )[1 ]
13+ rst_path = Path (rst_file )
14+ name = Path (rst_file ).stem
15+ lang = Path (name ).suffix
1516 if lang .startswith ('.' ):
1617 lang = lang [1 :]
1718 if lang == 'zh' :
1819 lang = 'zh_cn'
1920 else :
2021 lang = 'en'
21- html_file = name + '.html'
22+ html_path = Path ( name + '.html' )
2223 print (name , lang )
2324
24- with open (rst_file , encoding = 'utf-8-sig' ) as source :
25- with open (html_file , 'w' , encoding = 'utf-8' ) as destination :
25+ with rst_path . open (encoding = 'utf-8-sig' ) as source :
26+ with html_path . open ('w' , encoding = 'utf-8' ) as destination :
2627 output = publish_file (
2728 writer_name = 'html5' , source = source , destination = destination ,
2829 enable_exit_status = True ,
Original file line number Diff line number Diff line change @@ -106,8 +106,6 @@ select = [
106106]
107107# You can use `ruff rule ...` to see what these ignored rules check
108108ignore = [
109- " PTH122" ,
110- " PTH123" ,
111109 " S110" ,
112110]
113111line-length = 79
You can’t perform that action at this time.
0 commit comments