Page 1 of 1
Bwana vs man.conf...
Posted: Thu Mar 29, 2007 1:19 pm
by resuna
Imprimis, a bug report:
In man.conf:
MANSECT 1:8:2:3:4:5:6:7:9:0p:1p:3p:tcl:n:l:p:o
In bwana:
NSCharacterSet *sectionCharSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789n"];
Nota bene: Bwana can not locate pages in sections 0p, 1p, 3p, tcl, l, p, or o.
Suggestion: use section names from man.conf.
Secundus, an idea:
man:clock(foo) should be interpreted as man:clock.foo
even if foo isn't a section name known to man.conf.
Tertius, after looking at this and poking at the problem for a few brief moments, my hat's off to you and anyone else who's writing software in Objective C that's doing any text manipulation. The NSString class makes me want to convert all the NSStrings to C striungs and then convert back again, it's so brain damaged.
Quartus, Is there a way to make clicking on a link in Bwana to open the new page in the same instance of the plugin rather then a new window/tab?
Posted: Thu Mar 29, 2007 3:50 pm
by Conor
Thank you for the exact details. I have added the following code for the next version:
Code: Select all
NSCharacterSet *sectionCharSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789nlpo"];
//The section should be 1-9, n, p, l, o, 0p, 1p, 3p or tcl. Otherwise leave intact
if ([section length] == 1 && [section rangeOfCharacterFromSet:sectionCharSet].location != NSNotFound || [section isEqualToString:@"tcl"] || [section isEqualToString:@"0p"] || [section isEqualToString:@"1p"] || [section isEqualToString:@"2p"]) {
2) Things that are not sections will still get looked up by Bwana, such as [url=man://syslog.conf]man:syslog.conf[/url].
3) Yes strings are fun in objective-C, leads to really interesting code. Especially in young code like Bwana, my second objective-C project.
4) You must have changed the default script that Bwana uses; by default it opens in the same window that the link was clicked. Or you are not using Safari, I can't vouch for the other browser scripts as they were all written by users.
Posted: Thu Mar 29, 2007 4:14 pm
by resuna
Conor wrote:Thank you for the exact details. I have added the following code for the next version:
You probably need to get a list of strings from the config file, because you don't know when Apple will add a "perl" section, or what users will do.
I'd toss out some code for that but IIRC you're pulling stuff out of the file already elsewhere, so that's probably the place to do the job.
2) Things that are not sections will still get looked up by Bwana, such as [url=man://syslog.conf]man:syslog.conf[/url].
Suggested redesign: rather then trying to figure out what's a section, look the name up in the index and then if it fails try interpreting it as a section.
1. This relieves you of trying to track section naming conventions.
2. You've got no guarantee that there won't be an entry for
python2.3 or
tcl8.4 in section 1.
Alternatively, use something else for the separator. Traditionally in HTTP you'd put modifiers like the section in the isindex/cgi-variable part after the "?".
4) You must have changed the default script that Bwana uses; by default it opens in the same window that the link was clicked. Or you are not using Safari, I can't vouch for the other browser scripts as they were all written by users.
I'm not using Safari. Can you elaborate on this?
Posted: Fri Mar 30, 2007 4:52 am
by Conor
Bwana uses a AppleScript to load the page in the browser. If you poke inside bwana.app/Contents/Resources/Scripts.string in a text editor you will see the scripts that are used for each browser. There are several other script strings files included from users, such as one that opens new tabs in Safari instead of using the same window. The Safari script is:
Code: Select all
set URL of document 1 to "file://%@"
Which opens the page in the current window, which is how must people use it. Some change it as they call Bwana from the command line and want a new window to open. In your case you have to change the script for your browser to open in the same window.
Two things I am not good at are AppleScript and how to create a browser plug-in. Must of the Bwana code could be dropped into a plug-in and then the script could be avoided and also have the URL stay man:ls, as some users would like, instead of changing to the caches folder.
Thank you for all the suggestions on improving Bwana.
Posted: Mon Apr 02, 2007 8:12 am
by resuna
Conor wrote:Two things I am not good at are AppleScript and how to create a browser plug-in. Must of the Bwana code could be dropped into a plug-in and then the script could be avoided and also have the URL stay man:ls, as some users would like, instead of changing to the caches folder.
Thank you for all the suggestions on improving Bwana.
Aha. Well, you can't do it the way you're doing and make it browser-independant. If you can't make it a plugin, then you probably ought to make it a server. The URL would change to http://localhost:someport/... but it'd work for any browser. This is what RosettaMan does.
Posted: Wed Apr 04, 2007 2:09 am
by Conor
http://localhost:someport/...
Wouldn't be as exciting as man:...
Posted: Wed Apr 04, 2007 8:10 am
by resuna
Conor wrote:http://localhost:someport/...
Wouldn't be as exciting as man:...
man: would still work, it just wouldn't stay man: once the page was opened.
Posted: Wed Apr 04, 2007 8:44 am
by Conor
Now I am confused. If you still use man: then the program still has to use AppleScript to send the web page back to the browser since it's not a plug-in (it has to tell the browser to load
http://localhost). The way
http://localhost is useful is that if you use it from the beginning you just serve up the HTML without having to talk to the browser via AppleScript.
Posted: Wed Apr 04, 2007 9:05 am
by resuna
Conor wrote:Now I am confused. If you still use man: then the program still has to use AppleScript to send the web page back to the browser since it's not a plug-in
Yes, it has to do that *once*, for when you initially open the man page browser. Further links provided by the browser will be to
http://localhost and won't require that a new page be loaded, so you won't get new tabs opening up when you follow internal links.