File tree Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Expand file tree Collapse file tree 4 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 1- name : Python package
1+ name : CICD Python Package
22
33on :
44 push :
Original file line number Diff line number Diff line change 1- name : Test documentation building, and publish report to GitHub Pages
1+ name : Docs
22
33on :
44 push :
2727 run : |
2828 python -m pip install --upgrade pip
2929 pip install -e .[docs]
30- - name : Split README into sections
31- run : |
32- python docs/split_readme.py
3330 - name : Build references
3431 run : |
3532 cd docs
Original file line number Diff line number Diff line change 137137 PROJECT_ROOT = Path (__file__ ).parent .parent
138138 PACKAGE_ROOT = PROJECT_ROOT / "src" / "vuegen"
139139
140+ def run_split_readme (_ ):
141+ print ("[conf.py] Splitting README.md into sections..." )
142+ from split_readme import process_readme
143+
144+ readme_path = PROJECT_ROOT / "README.md"
145+ output_dir = PROJECT_ROOT / "docs" / "sections_readme"
146+ process_readme (readme_path , output_dir )
147+
140148 def run_apidoc (_ ):
149+ print ("[conf.py] Running sphinx-apidoc..." )
141150 from sphinx .ext import apidoc
142151
143152 apidoc .main (
@@ -155,4 +164,5 @@ def run_apidoc(_):
155164 )
156165
157166 def setup (app ):
167+ app .connect ("builder-inited" , run_split_readme )
158168 app .connect ("builder-inited" , run_apidoc )
Original file line number Diff line number Diff line change @@ -52,16 +52,14 @@ def convert_gfm_to_sphinx(content, links):
5252 return content
5353
5454
55- def process_readme ():
56- readme_path = Path (__file__ ).resolve ().parent .parent / "README.md"
57- readme = readme_path .read_text ()
55+ def process_readme (readme_path , output_dir ):
56+ readme = Path (readme_path ).read_text ()
5857
5958 # Extract links from README
6059 links = extract_links_from_readme (readme )
6160
62- # Create docs/sections directory
63- output_dir = Path ("./sections_readme" )
64- output_dir .mkdir (exist_ok = True )
61+ # Create output directory
62+ output_dir .mkdir (exist_ok = True , parents = True )
6563
6664 for section_title , filename in SECTION_MAPPING .items ():
6765 content = extract_section (readme , section_title )
@@ -76,4 +74,6 @@ def process_readme():
7674
7775
7876if __name__ == "__main__" :
79- process_readme ()
77+ default_readme = Path (__file__ ).resolve ().parent .parent / "README.md"
78+ output_sections_readme = Path ("./sections_readme" )
79+ process_readme (default_readme , output_sections_readme )
You can’t perform that action at this time.
0 commit comments