MCPcopy Create free account
hub / github.com/apache/solr / main

Function main

dev-tools/scripts/refguide/refguide-download-js-css.py:126–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

124 print(f"Updated {html_file_path}")
125
126def main():
127 parser = argparse.ArgumentParser(description='Process HTML files to localize external JS and CSS references.')
128 parser.add_argument('folder', help='Folder of svn checkout (https://svn.apache.org/repos/infra/sites/solr/guide/)')
129 args = parser.parse_args()
130
131 base_dir = args.folder
132
133 # Iterate over the folder structure
134 folders = [name for name in os.listdir(base_dir) if re.match(r'\d+_\d+', name)]
135 if not folders:
136 print(f"No versioned directories 'N_M' found in {base_dir}, exiting.")
137 return
138 for root_dir in folders:
139 print(f"\nProcessing directory {root_dir}")
140 print(f"=================================")
141 full_path = os.path.join(base_dir, root_dir)
142 if not os.path.exists(full_path):
143 print(f"Directory {full_path} not found, skipping.")
144 continue
145
146 js_dir = os.path.join(full_path, "js")
147 css_dir = os.path.join(full_path, "css")
148 os.makedirs(js_dir, exist_ok=True)
149 os.makedirs(css_dir, exist_ok=True)
150
151 skip_files = ["font-awesome.min.css"]
152
153 # Process each HTML file in the directory
154 for filename in os.listdir(full_path):
155 if filename.endswith(".html"):
156 html_file_path = os.path.join(full_path, filename)
157 process_html_file(html_file_path, js_dir, css_dir, skip_files)
158
159if __name__ == "__main__":
160 main()

Callers 1

Calls 4

process_html_fileFunction · 0.70
existsMethod · 0.65
matchMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…