Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

YUI 3 modules #34

Closed
wants to merge 4 commits into from

2 participants

@gaganpreet

Added YUI 3 modules in this pull request.

@rpicard

Could you modify this to use the general data file format? A good example to look use as a reference is firefox_about_config. Thanks!

@rpicard

@gaganpreet Hey there, I think this information might be better suited to a format like:

Type: Official
Description: <description goes here>

What do you think?

@gaganpreet

I like the suggestion. Also made the Type and Description text bold.

@rpicard

Thanks for making the changes. We generally use italics for this type of thing so I changed that in this commit. I'm going to see if anyone on this end thinks there should be some changes and I'll let you know what we come up with.

@rpicard

@gaganpreet YUI 3 Modules is live now! https://duckduckgo.com/?q=yui+button

Do you have a Twitter account that we could use for attribution?

@gaganpreet

Thanks @rpicard!

My twitter handle is _gagan: https://twitter.com/_gagan

@rpicard rpicard closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 29, 2012
  1. @gaganpreet

    Added YUI3 plugin

    gaganpreet authored
  2. @gaganpreet
Commits on Aug 5, 2012
  1. @gaganpreet
Commits on Aug 20, 2012
  1. @gaganpreet
This page is out of date. Refresh to see the latest.
View
2  yui3/README.txt
@@ -0,0 +1,2 @@
+Depdendencies:
+BeautifulSoup 3
View
4 yui3/fetch.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+mkdir data
+wget http://yuilibrary.com/yui/docs/guides/ -O data/official.html
+wget http://yuilibrary.com/gallery/show/ -O data/gallery.html
View
5 yui3/meta.txt
@@ -0,0 +1,5 @@
+Name: YUI Library
+Domain: yuilibrary.com
+Type: YUI 3 Module
+MediaWiki: 0
+Keywords: yui, yui 3, yui3
View
58 yui3/parse.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from BeautifulSoup import BeautifulSoup
+from collections import defaultdict
+# Use defaultdict to append duplicates, but output only the first entry
+
+modules = defaultdict(list)
+
+def normalize(string):
+ ''' -> Remove parantheses part from ending of module names
+ -> Remove YUI from module name
+ '''
+ return re.sub('( ?\(.*\)$|YUI\ ?[2-3]?[ -]?)', '', string)
+
+def get_descr_string(type, descr):
+ return '''<b>Type:</b> %s<br /><b>Description:</b> %s''' %(type, re.sub('(\n|\r)', '<br />', descr))
+
+# Parse the official modules
+official_soup = BeautifulSoup(open('data/official.html'))
+for module in official_soup.findAll('li', {'class' : 'component'}):
+ modules[module.a.text].append(dict(link = 'http://yuilibrary.com' + module.a['href'],
+ name = module.a.text,
+ descr = get_descr_string('Official', module.a['data-tooltip'])))
+
+# Parse the community supported gallery modules
+gallery_soup = BeautifulSoup(open('data/gallery.html'))
+for module in gallery_soup.findAll('a', href = re.compile('/gallery/show/.+')):
+ if 'patch' in module.text.lower():
+ continue
+ h4 = module.findNext('h4')
+ if h4.span:
+ descr = get_descr_string('Gallery, available on CDN', h4.span.next.next)
+ else:
+ descr = get_descr_string('Gallery', h4.next.next)
+
+ modules[normalize(module.text)].append(dict(link = 'http://yuilibrary.com' + module['href'],
+ descr = descr,
+ name = module.text))
+
+with open('output.txt', 'w') as f:
+ for name, value in modules.items():
+ f.write('\t'.join([
+ name, # title
+ 'A', # type
+ '', # redirect
+ '', # otheruses
+ '', # categories
+ '', # references
+ '', # see_also
+ '', # further_reading
+ '', # external_links
+ '', # disambiguation
+ '', # images
+ value[0]['descr'], # abstract
+ value[0]['link'] # source_url
+ ]) + "\n")
View
2  yui3/parse.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+python parse.py
View
2  yui3/queries.txt
@@ -0,0 +1,2 @@
+yui charts
+yui 3 accordion
Something went wrong with that request. Please try again.