Skip to content

Commit

Permalink
- Cleanup useless comments.
Browse files Browse the repository at this point in the history
- Rework wording for the README file.
  • Loading branch information
Matt Trudel committed Aug 14, 2009
1 parent c72e894 commit 56274ee
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 120 deletions.
70 changes: 40 additions & 30 deletions README
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@

USING PASTEBIN.D FILES

To enable support for private pastebins, first you will need to know the
fields that are in use by the pastebin when posting data.
To enable support for private pastebins, first you will need to know the fields
that are in use by the pastebin when posting data.

Add a file in the /etc/pastebin.d directory with the following format:

[psatebin]
basename = (the domain name of the pastebin site, without subdomains)
regexp = (a regular expression that identifies the base site, and any
subdomains that may be used)
[pastebin]
basename = domain.name
regexp = "http://(.*)\.?domain.name/"

[format]
pastebinit_field0 = site_field0
pastebinit_fieldN = site_fieldN
custom_field0 = site_fieldN
custom_fieldN = site_fieldN
reserved_keyword = pastebin_site_field
custom_keyword = pastebin_site_field

[defaults]
custom_field0 = value
custom_fieldN = value
custom_keyword = value


THE PASTEBIN SECTION
Expand All @@ -38,13 +34,14 @@ identify the pastebin. Only two fields are used in that section:

THE FORMAT SECTION

Under "[format]", identify the various fields in use in the pastebin you
are trying to add support for. Identify any fields used to publish data
on the pastebin, and add them to the configuration file.
Under "[format]", identify the various fields in use in the pastebin you want
to setup. Identify any fields used to publish data on the pastebin, and add
them to the configuration file.

The [format] section expects keywords from the pastebinit utility, for
which the values will be the actual name of the field in which to put the
data for that pastebin.
The "[format]" section expects reserved and custom keywords matched to the real
name for the field for the pastebin you are setting up. In other words, the
data that a reserved or custom keyword (the left-hand side) refers to will be
put in the named field assigned to it (the right-hand side).

A number of reserved keywords can be used, but are optional:

Expand Down Expand Up @@ -89,25 +86,38 @@ Two additional special parameters are available for use:
pastebins that don't redirect you
to the new post's URL.

Any other fields in use for the specific pastebin you are trying to enable
may be added to the section using a similar syntax. An easy way to deal with
such a requirement is to repeat the same keyword, such as:
Add any other fields in use for the specific pastebin you are setting up may be
added to the "[format]" section using the same syntax.

An easy way to deal with special parameters that need to be passed to the
pastebin, such as expiry time for a post, is to assign the pastebin's field
name to a variable, and set the correct value for that variable under the
"[defaults]" section later, as such:

[format]
expire = expire
expire = expiry

[defaults]
expire = 365

Where 'page' can then be reused as the keyword to retrieve a static value,
as set in the '[defaults]' section.
Where 'expire' can then be reused as the keyword to retrieve a static value in
the '[defaults]' section. See below for an example.


THE DEFAULTS SECTION

The '[defaults]' section is used to set static values for custom fields to
retrieve. Some pastebins require setting fields such as expiry time for
posts, or whether to use cookies. Such values would be set using a custom
field if they are deemed necessary. In the above example, to statically
set a page to be used in the 'page' field:
The '[defaults]' section is used to set static values for custom fields.

Some pastebins require setting fields such as expiry time for posts, or
whether to use cookies. Such values are set using a custom field, followed by
the value to give it.

To reuse the example above, statically set a post to be expire after 365 days:

[defaults]
expire = 3600
expire = 365

Here, the value 365 will be assigned to the expire keyword. In the "[format]"
section, the value in the expire keyword is applied to the field called
"expiry".

90 changes: 0 additions & 90 deletions pastebinit
Original file line number Diff line number Diff line change
Expand Up @@ -81,94 +81,6 @@ try:
params['save'] = "0" #Do you want a cookie ?
params['s'] = "Submit Post"
params['regexp'] = '">http://.*pastebin.ca/(.*)</a></p><p>'
# elif re.search("http://((([a-zA-Z0-9\-_\.]*)(1t2\.us)))", website):
# params['poster'] = user
# params['jid'] = jabberid
# params['code2'] = content
# params['parent_pid'] = parentpid #For reply, "" means homepage (new thread)
# params['format'] = format #The format, for syntax hilighting
# params['paste'] = "Send"
# params['remember'] = "0" #Do you want a cookie ?
# params['expiry'] = "f" #The expiration, f = forever
# params['permatag'] = permatag
# params['title'] = title
# params['username'] = username
# params['password'] = password
# params['version'] = version
# elif website == "http://rafb.net":
# if website == "http://rafb.net":
# params['page'] = "/paste/paste.php"
# params['nick'] = user
# params['text'] = content
# params['lang'] = "Plain Text" #The format, for syntax hilighting
# params['cvt_tabs'] = "No"
# elif website == "http://stikked.com":
# params['name'] = user
# params['title'] = title
# params['email'] = ""
# params['lang'] = "text" #The format, for syntax hilighting
# params['code'] = content
# params['website'] = ""
# params['submit'] = "submit"
# elif website == "http://slexy.org":
# if website == "http://slexy.org":
# params['page'] = "/index.php/submit"
# params['raw_paste'] = content
# params['comment'] = ""
# params['author'] = user
# params['language'] = "text" #The format, for syntax hilighting
# params['permissions'] = "0"
# params['desc'] = title
# params['linenumbers'] = "0"
# params['expire'] = "0"
# params['submit'] = "Submit Paste"
# elif website == "http://fpaste.org":
# params['lang'] = format #The format, for syntax hilighting
# params['page'] = "/paste/save"
# params['content'] = content
# params['submit'] = "pastebinit"
# elif website == "http://paste2.org":
# params['page'] = "/new-paste"
# params['description'] = title
# params['lang'] = format
# params['code'] = content
# params['parent'] = "0"
# elif re.search("http://((([a-zA-Z0-9\-_\.]*)(pastey\.net)))", website):
# params['author'] = user
# params['subject'] = title
# params['parent'] = pasteyParentFixup(website, parentpid)
# params['text'] = content
# params['language'] = format # File format, as a string like "cpp" or "lua"
# params['paste'] = "Paste"
# params['page'] = '/submit.php'
# params['regexp'] = '">http://(?:(?:[a-zA-Z0-9\-_\.]*)(?:pastey\.net))(/.*)</a>'
# elif website == "http://yourpaste.net":
# params['syntax'] = format
# params['name'] = user
# params['desc'] = title
# params['expire'] = "0" # Forever
# params['code'] = content
# params['private'] = "0" # It's not a private post
# params['remember'] = "0" # Cookies? ;)
# params['page'] = "/paste"
# params['regexp'] = '">http://yourpaste.net(.*)/</a>'
# elif website == "http://gist.github.com":
# params['page'] = "/gists"
# params['poster'] = user
# params['file_ext[gistfile1]'] = format #The format, for syntax hilighting
# params['file_contents[gistfile1]'] = content
# params['file_name[gistfile1]'] = title
# elif website == "http://paste.ubuntu.com":
# params['poster'] = user
# params['syntax'] = format #The format, for syntax hilighting
# params['content'] = content
# elif website == "http://paste.debian.net":
# params['poster'] = user
# params['lang'] = "-1" #The format, for syntax hilighting, default to plain text
# params['syntax'] = format #The format, for syntax hilighting
# params['code'] = content
# params['remember'] = "0" #Do you want a cookie ?
# params['expire'] = "259200" # expire in 72h
else:
for pastebin in pastebind:
if re.search( pastebind[pastebin]['pastebin']['regexp'], website ):
Expand All @@ -185,7 +97,6 @@ try:
elif param == 'format':
params[paramname] = format
elif param == 'parentpid':
#params[paramname] = parentpid
params[paramname] = doParentFixup(website, paramname, parentpid)
elif param == 'permatag':
params[paramname] = parmatag
Expand All @@ -197,7 +108,6 @@ try:
params[paramname] = jabberid
else:
params[paramname] = pastebind[pastebin]['defaults'][paramname]
#print params
if params:
return params
else:
Expand Down

0 comments on commit 56274ee

Please sign in to comment.