vimwiki / vimwiki

Personal Wiki for Vim
http://vimwiki.github.io/
Other
8.76k stars 628 forks source link

link-type challenges; keeps appending ".html#" #40

Closed linuxcaffe closed 10 years ago

linuxcaffe commented 10 years ago

Hi! I've recently set up a site using vimwiki (mostly) and vimwikiblog (a bit) and have been really delighted and the viki-level navigation and the resulting html. ..but I can't figure some things out! :)

One annoying problem is where I want to link to an html file that has no .html extension, and there seems to be a "#" appended to almost everything, is that .. normal?

so using this: [[./projects/taskwarrior/boards/1%3fpage%3d1%26per_page%3d100|User Support and Tips]]

I get this: http://www.taskextras.org/projects/taskwarrior/boards/1%3fpage%3d1%26per_page%3d100.html# (404)

but I want this: http://www.taskextras.org/projects/taskwarrior/boards/1%3fpage%3d1%26per_page%3d100

I've tried many combinations of link-types and schemes, gotta clue what I'm doing wrong?

EinfachToll commented 10 years ago

The reason for this behavior is that Vimwiki thinks that the link is a a link to a wiki file (isn't it?) and so it appends a .html as it does with every wiki link. As for the '#' at the end… I don't know :) Does it do what you want if you just append a http: before the link? [[http:./projects/taskwarrior/boards/1%3fpage%3d1%26per_page%3d100|User Support and Tips]]

EinfachToll commented 10 years ago

Looking a bit more closely, the issue with the # was obvious, and prepending a http: is not a solution. So the problem is that you don't want the .html extension, right? But… hey, it produces a HTML file, so why not add the appropriate extension?

linuxcaffe commented 10 years ago

If the "#" is obvious, I'm still guessing, no, prepending http: won't work, but the problem is not that I don't want an extension, the problem is that I have scadds of html files with no extension (legacy files, not wiki files) and I can't seem to make a link to them, as illustrated in the examples above.

EinfachToll commented 10 years ago

I mean that appending the '#' is obviously a bug and it's fixed by the latest commit.

As for the link: something like [[/bla/bla|description]] is a link to a wiki file, so it's the wrong way to go. I guess what you want is to link to an arbitrary file, that happens to be an html file. For this purpose there is the local: scheme, but using it you can only link to files relative to your wiki path, not your html output path, which is what you want, right? (BTW, can you post your g:vimwiki_list, to make sure we talk about the same things?) I think it's easiest to use a transclusion link and write a custom VimwikiWikiIncludeHandler (see the help file). Although the names are a bit misleading…. I can take a look the next days.

linuxcaffe commented 10 years ago

Great! I tried transclusion-type, unsuccesfully. My vimwiki_list is here: http://pastebin.com/KjmEFFa9, and I'm planning on githubbing the whole project sourcefiles and configurations, here: https://github.com/linuxcaffe/taskextras.org, as soon as I figure out how to get it cloned from ~/.vim/. as I think Taskextras might make a nice vimwiki+vimwikiblog showcase. Thanks for your help Einfach!

EinfachToll commented 10 years ago

Ok, but I just wonder how the www.taskextras.org appears when you say:

I get this: http://www.taskextras.org/projects/taskwarrior/boards/1%3fpage%3d1%26per_page%3d100.html#

Anyway, using VimwikiWikiIncludeHandler would work roughly like this: put this in your .vimrc:

function! VimwikiWikiIncludeHandler(value)
    let url = matchstr(a:value, g:vimwiki_rxWikiInclMatchUrl)
    if url[0] == '.'
        let url = 'http://www.taskextras.org/'.url[1:]
        return '<a href="'.url.'">'.url.'</a>'
    endif
    return ''
endfunction

and then use links like this: {{./projects/taskwarrior/boards1%3fpage%3d1%26per_page%3d100|User Support and Tips}}

linuxcaffe commented 10 years ago

On 19 March 2014 04:27, EinfachToll notifications@github.com wrote:

Ok, but I just wonder how the www.taskextras.org appears when you say:

I get this:

http://www.taskextras.org/projects/taskwarrior/boards/1%3fpage%3d1%26per_page%3d100.html#

sorry, there was an unexplained rsync to server in there :)

Anyway, using VimwikiWikiIncludeHandler would work roughly like this: put this in your .vimrc:

I'll try that, and thanks!

linuxcaffe commented 10 years ago

Alright, I haven't tried the above suggestion yet, I've been figuring out how to get the whole project up to GitHub. Success! So if you will, please go to https://github.com/linuxcaffe/taskextras.org to see the source for http://taskextras.org.

The problems related to this issue are best (worst) seen here: http://taskextras.org/boards.html , under the Forums heading, where the intent is something like what is seen, but without the appended ".html"

Specifically, the only link I'm testing (I'll change all the others when I figure it out) is the "User Support and Tips - files" links. Click them (404) then remove the ".html" from the location bar, to see where they should resolve to.

linuxcaffe commented 10 years ago

@EinfachToll , sorry to be pushy, I'm just a bit stalled, waiting for your opinions here. With the links above, can you see what's going on? I had hoped that by pushing it all to GitHub AND having the same site "live" might make it possible to explore "cause and effect", and currently the "effect" is a bit broken :) . thanks

EinfachToll commented 10 years ago

Sorry, I don't have the time (and knowledge) to help you with your project. But I can help you with Vimwiki. So please describe what you exactly do with Vimwiki, what yout type in, what is the result and what result did you expect. For the problem in your first post, I already provided you a solution. So tell my what's wrong (if there is something wrong).

linuxcaffe commented 10 years ago

No, I'M sorry Einfach, if I gave you the impression I was asking for help with "the project", I was trying to ask a vimwiki-specific question, and providing all the context. Let me try to re-phrase the question.

I'm trying to create this link: http://taskextras.org/projects/taskwarrior/boards/1%3fpage%3d1%26per_page%3d100

with this line: [[./projects/taskwarrior/boards/1%3fpage%3d1%26per_page%3d100|User Support and Tips]]

as seen here (line 15, first one below ====Forums====) https://raw.githubusercontent.com/linuxcaffe/taskextras.org/master/wiki/boards.wiki

.vimrc details are here: https://github.com/linuxcaffe/taskextras.org/blob/master/config/vimrc

and the result, that doesn't do what I need, is here: http://taskextras.org/boards.html

thanks :)

lwh commented 10 years ago

Why don't you use a normal link? Like this: [[http://taskextras.org/projects/taskwarrior/boards/1?page=1&per_page=100|This is a link to my thing]]

linuxcaffe commented 10 years ago

I could do that, but then the link would no longer be navigable locally from within vimwiki or from file:///home/djp/.vim/blog/index.html, which is one (two) of my favorite things about vimwiki.

..but I guess, in this case, local breakage might be the price for a working link,. could be worse :-)

EinfachToll commented 10 years ago

So did you try out my suggestion? https://github.com/vimwiki/vimwiki/issues/40#issuecomment-38027116

linuxcaffe commented 10 years ago

Yes, I tried it, and will publish the results, that didn't work On Apr 2, 2014 4:14 AM, "EinfachToll" notifications@github.com wrote:

So did you try out my suggestion? #40 (comment)https://github.com/vimwiki/vimwiki/issues/40#issuecomment-38027116

Reply to this email directly or view it on GitHubhttps://github.com/vimwiki/vimwiki/issues/40#issuecomment-39299969 .

linuxcaffe commented 10 years ago

ALrightee then, the site (taskextras.org) is updated with the transclusion-link test, as is the associated github. The only thing not updated is the ../config/vimrc entry, but I the link-handler code you suggested is in my local .vimrc, verbatim.

The site and github links above (5 comments up) still apply, and if you have a look at the ../boards.html page, you'll see that the transclusion-type link doesn't seem to produce a link at all, just inserts text.

So, trying not to be a big p.i.t.a., I guess what I'm asking for is a way to have the effect of a normal, literal link (http://blabla) but using a relative path, and without appending .html.

Thanks for looking at this. Your patience is appreciated. :-)

EinfachToll commented 10 years ago

Yeah, hm, I'm too lazy too take a look how this vimwiki-blog-thingie works. When you create the HTML, is Vimwiki's builtin converter used, or something different? And if it's used, is the HTML output altered by vimwiki-blog? And if so, can you take a look at the original HTML Vimwiki produces? I just tried it out, I put the IncludeHandler-function in my vimrc and put your boards.wiki into my wiki and used Vimwiki2HTML to convert it, and this is the output of the relevant link:

<a href="http://www.taskextras.org//projects/taskwarrior/boards1%3fpage%3d1%26per_page%3d100">http://www.taskextras.org//projects/taskwarrior/boards1%3fpage%3d1%26per_page%3d100</a>

(Yeah, I know, “works for me” is a frustrating answer when you look for help ;)

linuxcaffe commented 10 years ago

On 4 April 2014 03:22, EinfachToll notifications@github.com wrote:

Yeah, hm, I'm too lazy too take a look how this vimwiki-blog-thingie works.

Gosh! You ARE lazy! ;-) Part of the reason I went to all the trouble (wasn't bad, really) was so that the vimwiki developers (you+) could see a real-world vimwiki site in action.

When you create the HTML, is Vimwiki's builtin converter used, or something different?

vimwiki built-in.

And if it's used, is the HTML output altered by vimwiki-blog?

Only in that it adds some nav elements, templating and .css, but in the current taskextras.org site, vimwikiblog has not touched the html.

And if so, can you take a look at the original HTML Vimwiki produces? I just tried it out, I put the IncludeHandler-function in my vimrc and put your boards.wiki into my wiki and used Vimwiki2HTML to convert it, and this is the output of the relevant link:

http://www.taskextras.org//projects/taskwarrior/boards1%3fpage%3d1%26per_page%3d100

(Yeah, I know, "works for me" is a frustrating answer when you look for help ;)

That looks about right, I'm not sure why it didn't work for me. It's not so frustrating, rather encouraging knowing it CAN work, presuming bigger brains than mine :)

thanks again Einfach! (look at the links, you lazy so-and-so) djp

EinfachToll commented 10 years ago

Yeah so, if there is still an issue, feel free to reopen this one.