Hyperlink to specific paragraph possible?

Hello. I’m trying to use hyperlinks to outside pages in my university notes wiki, but I don’t know any HTML, and was hoping someone could point out a way to do this. Take this link;

The German Ideology

I’ve looked at the source, and worked out how to link to a subheading (the #p81 bit in this case). I’m trying to link to the fourth paragraph down from here, beginning “Since this evolution takes place naturally…”

Can this be done without actual anchors, just by counting paragraphs or jumping lines or something?

[Does this belong in scripting…?]

as far as i know, unless the source page’s fourth paragraph has an
anchor, you are out-of-luck in making a URL link directly to that para…

an option might be to (in your wiki) to quote the part of the para you
need to make your point and footnote it…

but! i have NOT looked at the rightful owners copyright notice…maybe
this is allowed, maybe not!!! so, be careful as you know most
universities frown of copyright violations!

imagine that!


brassy

There must be an anchor to be able to link to it.

It’s Marx! Hehe. Points for irony - but I don’t think he (or his estate) are around to slap a cease and desist notice on me, and the translations seem to be fairly freely reproduced by students; besides, this is just notes for personal consumption.

Thanks for the replies though - it isn’t really much of an issue, cos I can generally find a heading near what I’m quoting, but it would be nice to use some voodoo to jump right on top of it…

Yes, but it is not to be recommended. When you do not maintain the web-site yourself these sort of anchors are even more vulnarable then normal pages. A simple rewite of the document might spoil your intention. This is one aspect of so called “deep linking”.

I like that challenge that was a good one :wink:

Ok this is not yeah do this and took some googling. Stumbling across xpaths we can use the xpath to link to it. Now I don’t know of a browser that does this straight of, and this went beyond my pay grade but a solution it is.

First we need to find the xpath so we can create a bookmark, so we get https://addons.mozilla.org/en-US/firefox/addon/1095 so now with that installed highlight the section in the page, context click. You get a new option view xpath. Give you a pretty box with the element(I think), but bit you’re interested in is the path so for example the paragraph you want, becomes… /html/body/p[15]

So know we have the part we need but hold on a sec still need more yet, now using greasemonkey https://addons.mozilla.org/en-US/firefox/addon/748 so now this will allow you to change a page on the fly, still not quite done :wink: we now need a little script ecmanaut: XPath bookmarks click install from here. Now you can use urls with xpath elements, i.e for the one you want it has become

http://www.marxists.org/archive/marx/works/1845/german-ideology/ch01d.htm#xpath:/html/body/p[15]

works perfectly for me but without all the other bits it should just go to the top of the page.

@hcvv hehe I found a way :stuck_out_tongue:

It seems that you already read a lot about this xpaths. I spend only a glance so the following might be totaly wrong. xpaths seems to be something that works with XML. Now this is a bit tricky for me as I am not fluently with this. IMHO XHMTL (HTML4) comes under the XML umbrella, but earlier HTML version do not. And I just read a few hours ago that HTML5 will be HTML5 and XHTML5. So will xpaths work on both?

Now this may all be a bit theoretical and xpaths might work in practice. And as Confuseling can get it working and is happy with it …

Anyway nice result of your googling. As I have said in another thread: some people here on the forums stick like wolves on a problem until they found something. rotfl!

Eww no this definitely went above my paygrade not even sure what a xpath is. I just figured it must be possible to parse the web page in browser and stumbled across it.

That seems to be a java fix and that stuff I know nothing about, just know greasemonkey can be used for fixing broken sites never used it till this.

Sometimes being naive the looking is easier, I started with things around a custom anchor bookmark plugin. Then I came across xpath still not really sure, but I’ll bow to your reading and agree sounds like an xml element then java is making the bookmark.

But is a W3C standard, so it also not a negligable thing and may have a bright future.

hcvv; your concern is an entirely valid one (I’ve dabbled in C/C++, so I know the dangers of hard-coding anything, especially when the other side of the interface is out of your hands).

I guess what I can do is something like [Link] ([Link to paragraph]), so I’ve got redundancy if it breaks. Also, if I use a strict naming convention that won’t appear in MoinMoin syntax - (%Paragraph%) or something - for the name of the link, it should be relatively straightforward to write a script to remove them all again if they ever become useless / superseded - one of the advantages of MoinMoin using text files, rather than a database.

Feathermonkey; you are a gentleman (should that be gentlemonkey? :)), and a scholar!