gnewsense-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gNewSense-users] How to script wiki edits?


From: Bake Timmons
Subject: Re: [gNewSense-users] How to script wiki edits?
Date: Thu, 24 Apr 2008 01:09:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> I've been having some trouble figuring out how to edit the wiki sites
> automatically. Could someone help me out on this? Maybe Bake? I looked
> through kfv.el to see how you did it, and it seems that you did it
> somehow using the post-file option in wget. Anyhow, any help or useful
> links would be appreciated.

Use the source, Peter!  You do not even have to look at kfv.el, since it
creates uploading scripts with the relevant wget commands for this
process, e.g., when I did the net/irda directory, kfv.el generated
interesting files in:

~/.gns-kfv/usr/src/linux-2.6.24_12.22/net/irda/

In general, a kfv-upload.sh shell script is generated in such a
directory every time a user initiates the uploading process.  The script
demonstrates correct use of the wget options.  If you are in a hurry to
do something, just try to imitate what the script does.  I am sorry that
the following notes are not more organized, but I recall this stuff
being a bit messy to handle, with no all-in-one tutorial.  Good luck,
and after some playing around with it, just mention any problems that
you run into.  After all, maybe it could help someone else.

*Notes*

0.  Have some patience.  I recall being very frustrated learning things
that I had not planned on.  Reserve some blocks of time, get very
caffeinated, etc., and go after it hard.  Long story short, learning and
playing around from within Emacs probably was my biggest help. :)

1.  I had to learn some things about HTML forms by studying the source
of pages with those forms.  Since automated uploading scripts can wreak
havoc, I suggest you learn these things also.  Study the source of the
appropriate gNS forms!

2.  Any script should handle translation of characters that have special
meanings in the uploading process.  Whether you handle this *now*
depends on how limited your input data set is.  I recommend just getting
it done and writing your (simple) translation function.  Here is a
snippet from the net that I saved:

*Formatting Your Textfiles for http posting*

There are a few reserved characters in URL encoding that you cannot
use....the ampersand (&), the plus sign (+), and the percent sign (%).
As stated above, these are all used by URL encoding for special
purposes.  The use of these characters in your variables can confuse
and cause problems.  The ampersand would be "%26", the plus sign would
be "%2B", and the percent sign would be "%25".

3.  Since uploading scripts have such bad potential, you should first do
some tiny-scale testing with toy examples until you learn more and get
exactly what you want.  Clearly, you should study all output files and
downloaded pages to ensure 100% correctness.  Before you even upload,
ensure that your generated data is in the correct form.  This is easy to
do, since I assume that you are breaking your work up among several
functions.  (To be fair, kfv.el has had its share of bugs in uploaded
data, but not in form handling.  Those bugs I took care of early on.)

4.  From the kfv-upload.sh script, you will note two options useful for
uploading are --post-data and --post-file.  Also be very nitpicky about
correct quoting!!

5.  Just to save you some pain, I will warn you right now about correct
form handling.  Here is the critical top line of one of my post-data
files:

author=bt&csum=Updated irda entry.&post= Save &text=|| border=1

Note the four variables -- author, csum, post, and text.  Note that the
spaces in post were not generated for fun, i.e., post = " Save ".  This
and other fun stuff you should learn from studying the *source* of those
gNS forms. :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]