def read_type(elem):
	for m in elem('dl'):
		name = m.find(class_='descname').get_text()
		sig = m.dt.get_text().strip().rstrip(u'\xb6')
		desc_p = m.dd.find('p')
		desc = omnidoc.wrap(desc_p.get_text().replace('\n',' ')) if desc_p else []
		yield omnidoc.Entry(label=name, desc=[sig]+desc, action=omnidoc.Insert(sig))
Exemple #2
0
def h3_to_page(h3, parentname):
	name = h3.find('span', class_='name').get_text().strip()
	sig = h3.get_text().strip()
	# get the class name out of here, it's clutter
	sig = sig.replace(parentname+'::', '')
	description = find_desc_para(h3).get_text().strip()
	completion = sig # TODO a better completion
	return omnidoc.Entry(label=name, desc=[sig]+omnidoc.wrap(description, shorten=1), action=omnidoc.Insert(completion))
Exemple #3
0
def get_page(name):
	page    = bs4.BeautifulSoup(omnidoc.urlopen(page_url_format.format(name)))
	members = bs4.BeautifulSoup(omnidoc.urlopen(listpage_url_format.format(name)))
	title, hint = page.title.get_text().partition('|')[0].strip().split()[:2]
	for k in header(title=title, hint=hint, completion=title, doc_url=page_url_format.format(name)):
		yield k

	desc = page.find('h1', class_='title').find_next_sibling('p').get_text()
	desc = remove_trailing('More...', desc)
	yield omnidoc.Entry(label='Description', desc=omnidoc.wrap(desc), action=None)

	for li in members.find_all('li',class_='fn'):
		name = li.find('span', class_='name').get_text()
		sig = li.get_text()
		yield omnidoc.Entry(label=name, desc=sig, action=omnidoc.Insert(name))