Discussion:
can this be done in fossil: hyperlinking to subdir of fossil repo
(too old to reply)
Stephan Beal
2010-04-06 18:41:45 UTC
Permalink
Hi, all!

i'm developing a JavaScript RPC toolkit which i am of course hosting in
Fossil:


http://fossil.wanderinghorse.net/repos/JSONMessage/

that's all fine and good, but then i wanted to add a demo page. That
entailed adding a subdir under my project and leading the user there, of
course. But fossil defeats me...

If i have a link which simply says [demo/] then it treats it as a wiki page.
If i use [./demo] then when running in "fossil ui" mode fossil cannot find
the "demo" command (of course). i haven't tried [./demo] on the remote
server (CGI-based), but i suspect it _might_ work. i've tried using an A
HREF directly, but in local server mode that also gets intercepted.

My only working is using an absolute URL. The only problem with that is, if
i follow the link while using "fossil ui" then i end up on my remote server,
getting a different (probably older) copy of the demo.

i'm looking for a linking solution which will work both in local server
modes and CGI.

:-?

PS: this is not a big deal, just a minor annoyance. i'm not going to propose
any new features to support it if this cannot be done already.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
verizon
2010-04-06 19:10:41 UTC
Permalink
Hi,

From advice I got previously here is how I can access a PDF that is in the repository with a relative link (works both locally and in a server)

[http:doc/tip/Ethernet/DOCS/npincomplete.pdf | Code Description (pdf) ]

Your link should work similarly. The file is in <code base>/Ethernet/DOCS/npincomplete.pdf

--jim
Post by Stephan Beal
Hi, all!
http://fossil.wanderinghorse.net/repos/JSONMessage/
that's all fine and good, but then i wanted to add a demo page. That entailed adding a subdir under my project and leading the user there, of course. But fossil defeats me...
If i have a link which simply says [demo/] then it treats it as a wiki page. If i use [./demo] then when running in "fossil ui" mode fossil cannot find the "demo" command (of course). i haven't tried [./demo] on the remote server (CGI-based), but i suspect it _might_ work. i've tried using an A HREF directly, but in local server mode that also gets intercepted.
My only working is using an absolute URL. The only problem with that is, if i follow the link while using "fossil ui" then i end up on my remote server, getting a different (probably older) copy of the demo.
i'm looking for a linking solution which will work both in local server modes and CGI.
:-?
PS: this is not a big deal, just a minor annoyance. i'm not going to propose any new features to support it if this cannot be done already.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
_______________________________________________
fossil-users mailing list
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Stephan Beal
2010-04-06 21:03:03 UTC
Permalink
On Tue, Apr 6, 2010 at 9:10 PM, verizon <***@verizon.net> wrote:
Rene de Zwart
2010-04-06 21:36:12 UTC
Permalink
Stephan Beal
2010-04-06 22:07:16 UTC
Permalink
Its is a bit odd to run 2 http servers (well maybe not that odd)
Fossil's running on my remote box as a CGI. On my local box apache serves 5
or 6 sites and fossil (on 8080) runs in ui mode quite often.
use a link or a path to get de directory into the pages that apache
will serve. you could do [http://localhost/fossil/demo/my.php|php
demo].
That's what i do, but when i then upload to my remote repo that path no
longer works, and i don't want to update the wiki on every commit. Currently
i hard-code the link to the public site, and i don't see any way around
that. Maybe i could do it in TH, but that sounds like more hassle than it's
worth (i'm the only person affected by this problem).
It is the basic theme you could improve with virtual hosts so that your
development system uses the same naming (of course you have to edit your
local hostfile )
The development team == me, so nobody's hurting from this. Locally i
have/use vhosts, but i want to avoid setting up another subdomain on my
provider just for this mini-project.

Thanks for the attempt, though :).
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
Joshua Paine
2010-04-06 22:06:44 UTC
Permalink
So, you need to link to a PHP file which will be run by Apache under the
same domain and port as your wiki pages, right? If that's correct, this
shouldn't be too hard.

The first thing is to make sure you've got Apache configured to serve
the PHP correctly. If <http://fossil.wanderinghorse.net/demo/demo.php>
were the right path, and it were working, you'd just write your link
like <a href="/demo/demo.php">My Demo</a>.

The link should then work anywhere that you have your Apache + fossil
setup the same way as on fossil.wanderinghorse.net.

But I think you said you also want it to work via `fossil ui`. That's
impossible in plain HTML. `fossil ui` will start and connect to a web
server on a different port than your local dev web server. There's no
way to write a link that specifies the port but does not specify a
domain name.

If, however, you configure your local dev server to serve your local
fossil repo via CGI on the same local domain as you're testing your work
on, then a simple link like above should be fine.
--
Joshua Paine
LetterBlock LLC
http://letterblock.com/
Web applications built with joy.
Stephan Beal
2010-04-06 22:10:21 UTC
Permalink
Post by Joshua Paine
the PHP correctly. If <http://fossil.wanderinghorse.net/demo/demo.php>
were the right path, and it were working, you'd just write your link
Post by Joshua Paine
like <a href="/demo/demo.php">My Demo</a>.
THAT i didn't think of: i could move the demo path outside of the CGI's path
while still keeping it in the webroot. That would almost solve my problem,
except that i still have to (a) hard-code the server name in the Wiki link
and (b) i can't redirect that server name via /etc/hosts entries because i
also want to be able to access the public site.
Post by Joshua Paine
But I think you said you also want it to work via `fossil ui`. That's
impossible in plain HTML. `fossil ui` will start and connect to a web
i don't need the app to run in "ui", i just would like to be able to link to
a server-local subdir (or a higher-level dir, as you just suggested) from a
wiki page running in ui mode.

i think the higher-up dir would serve my purpose better than my current
approach - i'll give that a try.

:)
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
Joshua Paine
2010-04-06 23:04:40 UTC
Permalink
Post by Stephan Beal
THAT i didn't think of: i could move the demo path outside of the CGI's
path while still keeping it in the webroot. That would almost solve my
problem, except that i still have to (a) hard-code the server name in
the Wiki link and
You do not have to hard-code the server name so long as its the same as
the fossil repo is being served through. Just linking to "/foo/bar"
means "http://whatever-domain-we-are-on-now.com/foo/bar". It's the / at
the beginning that does that--just like a *nix filesystem path: `cd foo`
changes to 'working_directory/foo', but `cd /foo` changes to /foo.
--
Joshua Paine
LetterBlock LLC
http://letterblock.com/
Web applications built with joy.
Stephan Beal
2010-04-07 06:16:35 UTC
Permalink
Post by Joshua Paine
You do not have to hard-code the server name so long as its the same as
the fossil repo is being served through. Just linking to "/foo/bar"
means "http://whatever-domain-we-are-on-now.com/foo/bar". It's the / at
the beginning that does that--just like a *nix filesystem path: `cd foo`
changes to 'working_directory/foo', but `cd /foo` changes to /foo.
i tried that, but in CGI mode my index.cgi _is_ my root dir (as far as
Fossil CGI is concerned).

My setup is:

Apache on 3rd-party hoster:

http://fossil.wanderinghorse.net

under /repos/XXXX i have 12 or 15 repositories, each set up like:

repos/REPONAME/index.cgi

If i visit http://..../repo/Project, apache redirects me to
/.../Project/index.cgi, and that ends up being the top path for any absolute
OR relative links i add in Fossil (strangely enough, but i think that
actually makes an iota of sense for most CGI apps). Locally i don't use CGI,
but use "fossil ui" instead (much more convenient), which of course is
rooted in the repo.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
Joshua Paine
2010-04-07 10:27:06 UTC
Permalink
Post by Stephan Beal
i tried that, but in CGI mode my index.cgi _is_ my root dir (as far as
Fossil CGI is concerned).
Wait... so if on a fossil wiki page, you type <a href="/foo">Foo</a>
(the leading slash being essential), when you view that page in the
browser, fossil has converted your link to <a
href="/Project/index.cgi/foo">Foo</a> ? Are you sure? I can't reproduce
that at all--for me fossil isn't messing with my hand-written links.
'Cause if it's not messing with the HREF of your links, it doesn't
matter what fossil or Apache or the CGI gnomes think your root URL
is--<a href="/foo"> is still going to be a link to
'http://this-domain.com/foo'.
Post by Stephan Beal
Locally i
don't use CGI, but use "fossil ui" instead (much more convenient), which
of course is rooted in the repo.
Right--so such links won't (and never could) work in fossil ui. To make
them work in production and on your local dev machine, you'd have to use
CGI for fossil on your local machine, too--on the same domain as your
local demo pages.
--
Joshua Paine
LetterBlock LLC
http://letterblock.com/
Web applications built with joy.
Stephan Beal
2010-04-07 10:37:00 UTC
Permalink
Post by Joshua Paine
browser, fossil has converted your link to <a
href="/Project/index.cgi/foo">Foo</a> ? Are you sure? I can't reproduce
that at all--for me fossil isn't messing with my hand-written links.
Yup. See:

http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/wiki?name=Sandbox

i've put a link in the form [/repos] there and it resolves to:

http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/repos
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
Joshua Paine
2010-04-07 10:40:25 UTC
Permalink
Post by Stephan Beal
http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/repos
Sure... but if you just write the link in HTML (which fossil wiki allows
and allows to be mixed with wiki) instead of wiki markup:

<a href="/repos">test link</a>

Then you'll have a link to <http://fossil.wanderinghorse.net/repos>
--
Joshua Paine
LetterBlock LLC
http://letterblock.com/
Web applications built with joy.
Stephan Beal
2010-04-07 10:55:59 UTC
Permalink
Post by Stephan Beal
http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/wiki?name=Sandbox
http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/repos
Sorry, i half-lied there:

A link in the form [/repos] resolves as above. A link in the form <a
href='/repos'>...</a> resolves (incorrectly) to:

http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/%27/repos%27


A link in the form <a href=/repos>...</a> (which IS NOT valid HTML) resolves
to:

http://fossil.wanderinghorse.net/repos

yeah! (Except that the link requires invalid HTML.)
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
Joshua Paine
2010-04-07 11:10:37 UTC
Permalink
Post by Stephan Beal
A link in the form <a
http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/%27/repos%27
In HTML, attributes may be quoted with single quotes or double quotes,
but most people and software use double quotes.

<a href="/repos">...</a>

It rather looks like your browser mishandled your single-quoted
attribute there, which would be pretty weird. Try it with the double quotes.
--
Joshua Paine
LetterBlock LLC
http://letterblock.com/
Web applications built with joy.
Stephan Beal
2010-04-07 11:23:08 UTC
Permalink
Post by Stephan Beal
Post by Stephan Beal
A link in the form <a
http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/%27/repos%27
In HTML, attributes may be quoted with single quotes or double quotes,
but most people and software use double quotes.
<a href="/repos">...</a>
It rather looks like your browser mishandled your single-quoted
Post by Stephan Beal
attribute there, which would be pretty weird. Try it with the double quotes.
Right: when i use double-quotes it is processed as expected. But IMO this is
not a browser bug but Fossil's parsing of the attributes (which apparently
only accounts for double-quotes). Browser==Firefox 3.something, BTW.

i say it's a fossil bug because the generated single-quote HREF link renders
as:

<a href="'/repos'">test link with A HREF single-quoted</a>


which is obviously wrong.

Various examples:

http://fossil.wanderinghorse.net/repos/JSONMessage/index.cgi/wiki?name=Sandbox
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
Continue reading on narkive:
Loading...