Question
Based on some suggestions I found on the CoDev web, I decided to try using Lynx with an external editor to edit some of my larger TWiki pages. I found it rather cumbersome, but I'm a lynx newbie. Here is a description of what I had to do. I would appreciate any pointers on making the process more efficient.
- Start lynx using, for example:
lynx -editor=kedit http://domain/.../WikiPageToEdit. (I recognize I can set the editor in lynx.cfg, or set it using "o" for options after starting lynx.)
Aside: I did this from a "konsole" within kde. I suspect kedit will not work from a virtual console, especially if X is not running, but I will probably try it sometime -- at least, from a virtual console while X is running in another console.
- When the page comes up, navigate to the word "Edit" near the bottom of the page using PageDown and the Up and Down Arrow keys.
- If you are on a TWiki authenticated by password, you will get a message something like authorization failed, retrying, then you will be prompted for your userid and then password.
- The "standard" lynx edit display will appear (not your specified editor).
- Navigate down into the editable portion of the page. (When you are in the editable portion, you will see a message on the "message line" near the bottom of the screen which says something like "...press <ctrl>Xe..." to edit.)
- Press <ctrl>Xe which will call up the editor you specified.
- Edit your document, save your changes. (kedit will give you a message that it is saving to a temporary file.)
- Quit the editor. (You can probably combine this with the save step.) This will bring you back to the standard lynx edit display.
- Navigate to the phrase "Preview Changes", press <enter>.
- If you are on a TWiki which is authenticated by password (basic authentication??), you will see a "you are not authorized" type message, but the screen will go to the preview display.
- Navigate to the phrase "Save Changes", press <enter>.
- If you are on a TWiki which is authenticated by password, you will see a "you are not authorized" type message, but the screen will go to the view display, and the changes will be saved.
I thought (briefly) about trying to specify kedit with the ampersand to run it in the background -- I may try that just for kicks, but I have a feeling that, even if it works, it will be very confusing. (I suspect it will not work if I try to continue editing after a preview or save).
Without reading the lynx manpages, can anybody tell me if there is a way to set up a keyboard macro (within lynx) to do something like automatically find and select the "Edit" word (button) on the TWiki page?
Other suggestions? I imagine that most of what I did would apply no matter which external editor is used.
Hmmm, w3 mode in emacs? Naaa, probably not in this lifetime. (Knock on wood) (Aside: If I continue to use lynx I will learn how to change colors -- the current choices are very hard to see, especially on the default black background.)
- TWiki version: 20010315 Beta
- Web server: Apache
- Server OS: Mandrake 7.2 with MandrakeFreq update
--
RandyKramer - 16 May 2001
Answer
You can simplify this a little by specifying something like
http://twiki.org/cgi-bin/edit/Support/UsingLynxWithAnExternalEditor
as the URL to Lynx - this drops you right into edit mode.
Putting kedit into background probably won't work, because Lynx's call to run 'kedit &' will return immediately, before you have had a chance to edit the temp file.
As for keyboard macros, I'm sure there's some way of doing this in Linux - e.g. you could look at using
expect , which lets you script command-oriented and screen-oriented (aka 'curses') applications. See
http://expect.nist.gov/
and in particular
http://expect.nist.gov/FAQ.html#q20
If you use expect, you'll need to have a predictable set of keystrokes, independent of page length. You could of course modify the templates to have Preview and Save as some of the first links on the top of the page - since you are on the server itself you should never get incomplete pages retrieved, so very little risk of sending back a partial page after editing. You can have a special set of templates used only for Lynx, as long as you specify a suitable URL - see
TWikiTemplates and
TWikiSkins (in the March beta only).
I'd be interested to see what you come up with!
--
RichardDonkin - 17 May 2001
Richard,
Thanks very much for your comments! They all look like good suggestions, and you're right about Lynx's call to 'kedit &' returning before I have a chance to edit the temp file.
Expect looks like something I've been looking for for a while (well, I'd heard of it before, but hadn't thought of it in terms of generating keyboard macros). But, it will take more than 5 minutes until I do anything useful with it. (I read some things including part of the man pages in the suggested order -- spawn, send, expect, then interact, and found autoexpect and generated a massive (but useless) script. I'll have to learn considerably more, including how to do some things conditionally. You're also right in that a script will work better if I create special templates with the Edit, Preview, and Save Changes at the top of the respective template.)
So, I guess my answer is that it may be quite a while before I get something useful here -- as I get my TWiki ready for
SourceForge I will be modifying the templates anyway, but everything takes 10 times as long as I expect.
Anyway, thanks again, and, if you've ever tried editing a TWiki with Emacs, drop on over to
UsingEmacsToEditTwiki and help me get past the roadblocks in using Emacs. (I did Ok for a first trial, but I got stuck at saving my changes -- see that page.)
Oh, BTW, for the record (and commenting on my own original choice of editor), Nedit seems to be a better choice of editor than Kedit, mainly because it has the feature that I call soft wrapping (Nedit calls it "continuous" wrapping) -- it wraps the text on your screen without inserting newlines to wrap it permanently. (Nedit has other useful features, including macros and regular expression search. I haven't used the macro feature yet, but it's not the cross-application feature I'd like to find.)
--
RandyKramer - 17 May 2001