@@ -145,6 +145,7 @@ def do_embed(*, project, version, doc=None, path=None, section=None, url=None):
145
145
146
146
content = None
147
147
headers = None
148
+ # Embed API v2 supports Sphinx only.
148
149
if version .is_sphinx_type :
149
150
file_content = _get_doc_content (
150
151
project = project ,
@@ -160,18 +161,7 @@ def do_embed(*, project, version, doc=None, path=None, section=None, url=None):
160
161
url = url ,
161
162
)
162
163
else :
163
- # TODO: this should read from the html file itself,
164
- # we don't have fjson files for mkdocs.
165
- file_content = _get_doc_content (
166
- project = project ,
167
- version = version ,
168
- doc = doc ,
169
- )
170
- content , headers , section = parse_mkdocs (
171
- content = file_content ,
172
- section = section ,
173
- url = url ,
174
- )
164
+ return None
175
165
176
166
if content is None :
177
167
return None
@@ -310,47 +300,3 @@ def dump(obj):
310
300
311
301
ret = [dump (clean_references (obj , url )) for obj in query_result ]
312
302
return ret , headers , section
313
-
314
-
315
- def parse_mkdocs (content , section , url ): # pylint: disable=unused-argument
316
- """Get the embed content for the section."""
317
- ret = []
318
- headers = []
319
-
320
- if not content or not content .get ('content' ):
321
- return (None , None , section )
322
-
323
- body = content ['content' ]
324
- for element in PQ (body )('h2' ):
325
- headers .append (recurse_while_none (element ))
326
-
327
- if not section and headers :
328
- # If no section is sent, return the content of the first one
329
- section = list (headers [0 ].keys ())[0 ].lower ()
330
-
331
- if section :
332
- body_obj = PQ (body )
333
- escaped_section = escape_selector (section )
334
- section_list = body_obj (
335
- ':header:contains("{title}")' .format (title = str (escaped_section )))
336
- for num in range (len (section_list )):
337
- header2 = section_list .eq (num )
338
- # h2_title = h2.text().strip()
339
- # section_id = h2.attr('id')
340
- h2_content = ""
341
- next_p = header2 .next ()
342
- while next_p :
343
- if next_p [0 ].tag == 'h2' :
344
- break
345
- h2_html = next_p .outerHtml ()
346
- if h2_html :
347
- h2_content += "\n %s\n " % h2_html
348
- next_p = next_p .next ()
349
- if h2_content :
350
- ret .append (h2_content )
351
- # ret.append({
352
- # 'id': section_id,
353
- # 'title': h2_title,
354
- # 'content': h2_content,
355
- # })
356
- return (ret , headers , section )
0 commit comments