@@ -74,7 +74,6 @@ def generate_site():
74
74
<title>{{ page.title | default: site.title }}</title>
75
75
<link rel="stylesheet" href="{{ \" /assets/css/style.css\" | relative_url }}">
76
76
<link rel="icon" type="image/png" href="{{ \" /assets/css/pytorch-logo.png\" | relative_url }}">
77
- <script src="{{ \" /assets/js/search.js\" | relative_url }}"></script>
78
77
</head>
79
78
<body>
80
79
{{ content }}
@@ -115,18 +114,13 @@ def generate_site():
115
114
f .write (jekyll_config )
116
115
print ('Generated _config.yml' )
117
116
118
- search_index_data = []
119
-
120
117
# Generate index.md
121
118
index_md = """\
122
119
---
123
120
layout: default
124
121
---
125
122
Below are all known graph breaks detected by Dynamo.
126
123
127
- <input type="text" id="search-input" placeholder="Search graph breaks...">
128
- <div id="search-results"></div>
129
-
130
124
"""
131
125
132
126
# Add registry items to index.md
@@ -138,57 +132,6 @@ def generate_site():
138
132
f .write (index_md )
139
133
print ('Generated index.md' )
140
134
141
- # Add JavaScript for search
142
- search_js = '''
143
- (function() {
144
- var idx;
145
- var docs = {};
146
-
147
- // Fetch the search data
148
- fetch('{{ site.baseurl }}/search_data.json')
149
- .then(response => response.json())
150
- .then(data => {
151
- idx = lunr(function () {
152
- this.ref('id');
153
- this.field('title', { boost: 10 });
154
- this.field('search_content');
155
-
156
- data.forEach(function (doc) {
157
- this.add(doc);
158
- docs[doc.id] = doc;
159
- }, this);
160
- });
161
-
162
- var searchInput = document.getElementById('search-input');
163
- var searchResults = document.getElementById('search-results');
164
-
165
- searchInput.addEventListener('keyup', function () {
166
- var query = this.value;
167
- if (query.length < 2) {
168
- searchResults.innerHTML = '';
169
- return;
170
- }
171
-
172
- var results = idx.search(query);
173
- var html = '<ul>';
174
- if (results.length === 0) {
175
- html += '<li>No results found.</li>';
176
- } else {
177
- results.forEach(function (result) {
178
- var doc = docs[result.ref];
179
- html += '<li><a href="' + doc.url + '">' + doc.title + '</a> — ' + doc.gb_type + '</li>';
180
- });
181
- }
182
- html += '</ul>';
183
- searchResults.innerHTML = html;
184
- });
185
- });
186
- })();
187
- '''
188
- with open (os .path .join (output_dir , 'index.md' ), 'a' ) as f :
189
- f .write (search_js )
190
- print ('Appended search JavaScript to index.md' )
191
-
192
135
# Generate individual GBID pages
193
136
gb_dir = os .path .join (output_dir , 'gb' )
194
137
Path (gb_dir ).mkdir (exist_ok = True )
@@ -248,22 +191,6 @@ def generate_site():
248
191
f .write (detail_md )
249
192
print (f'Generated { file_path } ' )
250
193
251
- # Add data to search index
252
- search_content = f"{ entry .get ('Gb_type' , '' )} { entry .get ('Context' , '' )} { entry .get ('Explanation' , '' )} { hints_content } { manual_content } "
253
- search_index_data .append ({
254
- 'id' : gbid .lower (),
255
- 'title' : gbid ,
256
- 'url' : f'gb/{ gbid .lower ()} .html' ,
257
- 'gb_type' : entry .get ('Gb_type' , '*No Gb_type provided.*' ),
258
- 'search_content' : search_content .replace ('\n ' , ' ' ).replace ('\r ' , ' ' ).strip ()
259
- })
260
-
261
- # Write search index to JSON file
262
- search_data_path = os .path .join (output_dir , 'search_data.json' )
263
- with open (search_data_path , 'w' ) as f :
264
- json .dump (search_index_data , f , indent = 2 )
265
- print (f'Generated { search_data_path } ' )
266
-
267
194
print ('Site generation complete!' )
268
195
269
196
0 commit comments