Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Firefox about:config #28

Closed
wants to merge 21 commits into from

1 participant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 26, 2012
  1. @nospampleasemam
  2. @nospampleasemam

    beginning parse.py

    nospampleasemam authored
  3. @nospampleasemam
  4. @nospampleasemam
  5. @nospampleasemam
  6. @nospampleasemam
  7. @nospampleasemam
  8. @nospampleasemam
Commits on Jun 28, 2012
  1. @nospampleasemam
Commits on Jun 29, 2012
  1. @nospampleasemam
Commits on Jun 30, 2012
  1. @nospampleasemam
  2. @nospampleasemam
  3. @nospampleasemam
  4. @nospampleasemam
  5. @nospampleasemam
Commits on Jul 7, 2012
  1. actually don't show empty descriptions

    Dylan Lloyd authored
  2. edited formatting, removed "how to edit" link

    Dylan Lloyd authored
Commits on Jul 8, 2012
  1. @nospampleasemam
Commits on Jul 12, 2012
  1. @nospampleasemam
Commits on Jul 16, 2012
  1. @nospampleasemam
Commits on Jul 19, 2012
  1. @nospampleasemam
This page is out of date. Refresh to see the latest.
View
5 firefox_about_config/README.txt
@@ -0,0 +1,5 @@
+Firefox about:config plugin for DuckDuckGo
+
+Dependencies:
+Python 2.7
+BeautifulSoup 4 (pip install beautifulsoup4)
View
1  firefox_about_config/data.url
@@ -0,0 +1 @@
+http://kb.mozillazine.org/About:config_entries
View
6 firefox_about_config/fetch.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+mkdir download
+cd download
+wget http://kb.mozillazine.org/About:config_entries
+cd ../
View
5 firefox_about_config/meta.txt
@@ -0,0 +1,5 @@
+Name: Firefox about:config
+Domain: http://kb.mozillazine.org/About:config_entries
+Type: Firefox configuration
+MediaWiki: 0
+Keywords: firefox config,firefox configuration,firefox about, firefox about config,firefox about:config,ff config, ff configuration, ff about, ff about config, ff about:config
View
549 firefox_about_config/output.txt
549 additions, 0 deletions not shown
View
90 firefox_about_config/parse.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python2
+
+from BeautifulSoup import BeautifulSoup, NavigableString
+import urllib
+import string
+import re
+
+
+class Entry(object):
+ def __init__(self, name, value, description, url):
+ self.name = name
+ self.value = value
+ self.description = description
+ self.url = url
+
+ def __str__(self):
+ fields = [
+ self.name, # title
+ 'A', # type
+ '', # redirect
+ '', # otheruses
+ '', # categories
+ '', # references
+ '', # see_also
+ '', # further_reading
+ '', # external_links
+ '', # disambiguation
+ '', # images
+ self.description, # abstract
+ self.url # source_url
+ ]
+ return '%s' % ('\t'.join(fields))
+
+
+class Parser(object):
+ def __init__(self, input='download/About:config_entries'):
+ self.soup = BeautifulSoup(open(input))
+ # Requires trailing / for relative link replacement
+ self.baseURL = "http://kb.mozillazine.org/"
+
+ def findEntries(self):
+ self.entries = []
+ headers = map(lambda x: x.string, self.soup.findAll('h1')[2:])
+ table = self.soup.findAll('div', id="bodyContent")[0]
+ for table in table.findAll('table'):
+ header = True
+ for tr in table.findAll('tr'):
+ if header:
+ header = False
+ continue
+ i = 0
+ for th in tr.findAll('td'):
+ description = ''
+ if i == 0:
+ name = ''.join(th.b.findAll(text=True)).replace(' ','')
+ anchor = string.capitalize(urllib.quote(name.split('.')[0])) + "."
+ if anchor in headers:
+ url = self.baseURL + 'About:config_entries#' + anchor
+ else:
+ url = self.baseURL + 'About:config_entries'
+ elif i == 1:
+ value = th.text
+ elif i == 2:
+ if value:
+ article = 'a'
+ if value[0] == 'I': article += 'n'
+ optionType = "it accepts " + article + " " + value.lower() + "."
+ synopsis = '"' + name + '"' + ' is a configuration option ' \
+ 'for the Firefox web browser; ' + optionType + "<br>"
+ for tag in th.findAll('br'):
+ tag.insert(0, NavigableString("\n"))
+ description = ''.join(th.findAll(text=True))
+ description = description.rstrip().replace('\n', '<br>').strip()
+ expandedURL = 'href="' + self.baseURL
+ description = description.replace('href="/', expandedURL)
+ description = re.sub('<\s*b\s*>', '<i>', description)
+ description = re.sub('<\s*/\s*b\s*>', '</i>', description)
+ description = '<blockquote>' + description + '</blockquote>'
+ description = synopsis + description
+ i = -1
+ self.entries.append(Entry(name, value, description.strip(), url))
+ i += 1
+
+
+if __name__ == "__main__":
+ parser = Parser()
+ parser.findEntries()
+ with open('output.txt', 'w') as file:
+ for entry in parser.entries:
+ file.write(entry.__str__().encode('UTF-8') + '\n')
View
3  firefox_about_config/parse.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+/usr/bin/env python2 parse.py
View
1  firefox_about_config/queries.txt
@@ -0,0 +1 @@
+firefox network cookie
Something went wrong with that request. Please try again.