Bwana vs man.conf...

Tell us about your wildest feature dreams. Or just harmless suggestions for improvement.
Post Reply
resuna
Contributor
Contributor
Posts: 5
Joined: Thu Mar 29, 2007 1:03 pm

Bwana vs man.conf...

Post 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?
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Post 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.
resuna
Contributor
Contributor
Posts: 5
Joined: Thu Mar 29, 2007 1:03 pm

Post 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?
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Post 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.
resuna
Contributor
Contributor
Posts: 5
Joined: Thu Mar 29, 2007 1:03 pm

Post 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.
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Post by Conor »

http://localhost:someport/...
Wouldn't be as exciting as man:... :(
resuna
Contributor
Contributor
Posts: 5
Joined: Thu Mar 29, 2007 1:03 pm

Post 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.
User avatar
Conor
Top Dog
Posts: 5346
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Post 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.
resuna
Contributor
Contributor
Posts: 5
Joined: Thu Mar 29, 2007 1:03 pm

Post 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.
Post Reply