Not logged in. · Lost password · Register
Forum: General Help and Support Plugins Plugin Wishlist RSS
Copy internal section link
Page:  1  2  next 
Avatar
mforkel #1
Member since Jun 2007 · 99 posts
Group memberships: Members
Show profile · Link to this post
Subject: Copy internal section link
Hi,

I often use internal section links in my wiki pages. For lack of a better solution, I edit the target section, press cancel, copy the internal link from the browser's link field, switch pages in the browser, paste the link into the page I'm editing, go back to the target section page, copy the section title, and paste it into the editor. It takes even longer to go through this procedure than to read through my description  ;-).

Am I missing something? Is there a simple way to copy a complete section link [[namespace:page#section|section title]] onto the clipboard, while the section is displayed in the browser? E.g. some modifier key + mouse click on the section title? If not, is anybody out there able and willing to write a plugin that does the trick?

Thanks, Malte
Avatar
mforkel #2
Member since Jun 2007 · 99 posts
Group memberships: Members
Show profile · Link to this post
Any opinions, any volunteers? Or some benevolent advice on how to do it myself?
Avatar
turnermm (Moderator) #3
Member since Oct 2009 · 4690 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
A simple technique would be to use your table of contents on the target page.  Click on the heading that you want to use as a link and copy the result from the browser's location bar.  For instance you will get something like this:

http://www.mturner.org/fckgLite/doku.…?id=wiki:syntax#wi…

Just copy wiki:syntax#windows_shares and paste it into the editor.  You may want to prepend a colon to the namespace, for instance

           :wiki:syntax#windows_shares

You can't get this from the HTML in the browser window.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
This post was edited on 2010-08-03, 16:01 by turnermm.
Avatar
mforkel #4
Member since Jun 2007 · 99 posts
Group memberships: Members
Show profile · Link to this post
Thanks for your suggestion, turnermm!

Unfortenately, my tables of contents only show the top three section levels. Anything below is not accessible from there. Plus, I'm still hoping to get link plus title in one operation somehow, rather than having to copy and paste both of them seperately  ;-) .
Avatar
turnermm (Moderator) #5
Member since Oct 2009 · 4690 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
You can increase the number of items in the table of contents in the configuration mananger. 

I guess I'm missing something but I thought what I suggest gives both link and title:

Just copy wiki:syntax#windows_shares and paste it into the editor.  You may want to prepend a colon to the namespace, for instance

           :wiki:syntax#windows_shares

the link is :wiki:syntax and the title is windows_shares
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
mforkel #6
Member since Jun 2007 · 99 posts
Group memberships: Members
Show profile · Link to this post
Of course, you're right principally. But please remember that I'm looking for a method that is more comfortable than the one I described in my original posting (fake edit to copy the link plus copy the section title).

Following your suggestion, I'd have to scroll from the section that I've found and want to link to back to the top of the page and find the section's heading in the menu. Because some of my pages have quite a number of sections the menus would be very big (and might get in the way of just reading the page). But more importantly, the section link might require quite some editing. My native language is German, so the "real" section titles include capital letters and umlauts. Plus, a couple of characters get converted or cut when a section title is transformed into a section reference. I'd have to undo all those changes, which on average is probably more work than copying the section title.

So while I really appreciate your suggestions, I don't think it would make things easier for me.
Avatar
ryan.chappelle #7
User title: Chilean DW Fan
Member since May 2008 · 218 posts · Location: Temuco, Chile
Group memberships: Local Moderators, Members, Newsletter Team
Show profile · Link to this post
Editing the PHP files for the header/TOC code to include also a "wikified" version of the section links, or creating a plugin that does so, would be in order then. Links are usually printed via something like wl($pagename), there $pagename is usually the ID that you'll want to print. The "purple headers" plugin would be a good place to start.
Chilean DW Fan!
my plugins for DokuWiki
GULIX, my area's LUG
Surviving earthquakes since Feb 2010!
Avatar
mforkel #8
Member since Jun 2007 · 99 posts
Group memberships: Members
Show profile · Link to this post
Thanks! The PurpleNumbers Plugin looks very promising to me and I have contacted its author. May be I can even persuade her to add the functionality that I'm looking for. Unfortenately, I'm not knowledgeable enough to do it myself.
This post was edited on 2010-08-31, 17:13 by mforkel.
Avatar
ach (Administrator) #9
Member since May 2006 · 1926 posts · Location: Folkestone, UK
Group memberships: Administrators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
At first I thought that the PurpleNumbers plugin would be a good candidate to do the job. But as all the information we need is already present, I just wrote a little JavaScript instead which does the job:
http://www.dokuwiki.org/tips:copy_section_link
Avatar
mforkel #10
Member since Jun 2007 · 99 posts
Group memberships: Members
Show profile · Link to this post
Thanks for your help, ach!

I tested your function in Firefox 3.6.12 and IE 8.0. In Firefox, the link text shows up to the right of the title. This feedback is probably good from a user interface design perspective. Selecting the text with the mouse is somewhat difficult, though. But I don't like my initial idea of clicking the heading to copy a link to much, either. Its just a well hidden feature. Would it be possible to show the link text in a floating box (just like a regular link text is shown) and support copying it by Ctrl-C? In IE, I don't see anything and don't know how to copy the link text.

I often run into problems when using internal links because some of my pages contain non-unique headings. A regular internal link will then point to the first one of them and I don't know how to specify a link to any of the later sections. This is why I still think a combination of creating internal links and creating unique IDs would be great... ;-)
Avatar
ach (Administrator) #11
Member since May 2006 · 1926 posts · Location: Folkestone, UK
Group memberships: Administrators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
Quote by mforkel:
In Firefox, the link text shows up to the right of the title. This feedback is probably good from a user interface design perspective. Selecting the text with the mouse is somewhat difficult, though.
[...]
Would it be possible to show the link text in a floating box (just like a regular link text is shown) and support copying it by Ctrl-C?
I'm not sure if I understand what you mean. Do you mean just always showing the wiki link to the right hand side of the title?
That could be easily done by changing display: none; to display: inline; or display: block; (and by completely removing the lower :hover styles). But I think that would be at the expense of losing readability and usability ...

Another option could be to add it in a tooltip like the footnotes. I guess that would be a good solution.
I currently have no time to implement that, but I just changed the styles a bit to come closer to that (and it even fixes some other issues).

And one tip, one word how to select the wiki links easier: triple-click! ;-)

Quote by mforkel:
In IE, I don't see anything and don't know how to copy the link text.
If it's not IE6, it's probably just a caching issue.

Quote by mforkel:
I often run into problems when using internal links because some of my pages contain non-unique headings. A regular internal link will then point to the first one of them and I don't know how to specify a link to any of the later sections.
The IDs created by DokuWiki are already unique. If you check the TOC in a page with non-unique headings, you'll see that the section links are all different (extended by numbers).
Avatar
mforkel #12
Member since Jun 2007 · 99 posts
Group memberships: Members
Show profile · Link to this post
Instead of just being the wise guy I'd rather implement something myself. If only I knew anything about JavaScript, CSS, ...

Quote by ach on 2010-11-21, 15:55:
I'm not sure if I understand what you mean. Do you mean just always showing the wiki link to the right hand side of the title?
That could be easily done by changing display: none; to display: inline; or display: block; (and by completely removing the lower :hover styles). But I think that would be at the expense of losing readability and usability ...
I totally agree. I think a "link indicator" should only be shown while the mouse is right over the section title in order to minimize distraction. Finding the ideal placement might be difficult, though. E.g., if the link indicator is always shown above the heading, its invisible if the heading is on the top line.

Quote by ach on 2010-11-21, 15:55:
Another option could be to add it in a tooltip like the footnotes. I guess that would be a good solution.
I currently have no time to implement that, but I just changed the styles a bit to come closer to that (and it even fixes some other issues).
You're right, a tooltip is what I had in mind. I just couldn't come up with the word. I think that would be a good solution for showing the link. Is there any user interface standard for an action associated with a tooltip? What should the user do to copy the link text while the tooltip is visible? Ctrl-C, click the tooltip, ...

Showing a tooltip just while the mouse is over the section title might solve another problem as well. Unfortenately, there seems to be an incompatibility between the current implementation and the editsections Plugin. That plugin places the edit button for a section to the right of its heading. But that button is now "covered", I can't click it anymore.

What do you think about a link button, placed to the far right of the section heading (adjacent to edit button positioned by the editsections plugin)? With a small icon, it shouldn't be too intrusive. Its tooltip could show the the link text. And clicking the button to copy that link text is a well defined action.

It's easy to make all these suggestions as long as I'm not running the risk of having to implement them :-)

Quote by ach on 2010-11-21, 15:55:
The IDs created by DokuWiki are already unique. If you check the TOC in a page with non-unique headings, you'll see that the section links are all different (extended by numbers).
Thanks for pointing that out! Now I know what you meant earlier when you said that all the information was already there. Actually it took me a couple of weeks to understand why I was so surprised by this: After using the DokuWiki editor, you're taken to the top of the section just edited. But if that section has a non-unique heading, you're taken to the top-most section that has the same heading. That had happened to me so often, that I never thought DokuWiki could try to create unique anchors.

Can anybody confirm that "bug"? Should I write a bug report?
Avatar
ach (Administrator) #13
Member since May 2006 · 1926 posts · Location: Folkestone, UK
Group memberships: Administrators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
Quote by mforkel on 2010-12-19, 21:47:
After using the DokuWiki editor, you're taken to the top of the section just edited. But if that section has a non-unique heading, you're taken to the top-most section that has the same heading. That had happened to me so often, that I never thought DokuWiki could try to create unique anchors.

Can anybody confirm that "bug"? Should I write a bug report?

Yes, this is a known bug. See http://bugs.splitbrain.org/index.php?do=details&task_i…
Avatar
danmundy #14
Member since Oct 2016 · 2 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #9
ach, if you're listening, thanks! Your code is exactly what I was looking for and works perfectly.
Avatar
sancaya #15
Member since Aug 2013 · 37 posts · Location: Vnukovo
Group memberships: Members
Show profile · Link to this post
I added there a function to select that wikiLink by mouse-clicking on the headline, because selecting manually can be not so convenient. See https://www.dokuwiki.org/tips:copy_section_link#an_improve…
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next 
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-08-24, 02:40:26 (UTC +02:00)