Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add processing for url fragments to vimwiki_link #23

Merged
merged 1 commit into from
Feb 22, 2020

Conversation

djeremiah
Copy link
Contributor

Added some processing for links with url fragments, such as those generated by :VimwikiTOC or or when using a diary_caption_level >0

@djeremiah djeremiah force-pushed the feature/url-fragments branch from fc10ecf to b67e181 Compare February 22, 2020 12:02
@patrickdavey patrickdavey merged commit 1198690 into patrickdavey:master Feb 22, 2020
@patrickdavey
Copy link
Owner

Thanks @djeremiah - looks good 👍

@patrickdavey
Copy link
Owner

I've pushed out 0.4.2 , should be good to update now. Thanks again.

@patrickdavey
Copy link
Owner

patrickdavey commented Feb 23, 2020

Hmmm, actually, this is going to break people's links ... for example, this spec will fail now

    it "should not alter fragments which are part of a url" do
      markdown_link = "[test](http://foo#Bar)"

      link = VimwikiLink.new(markdown_link, source_filepath, markdown_extension, root_path)
      expect(link.title).to eq("test")
      expect(link.uri).to eq("http://foo#Bar")
    end

What do you think should be the expected behavior @djeremiah ? I think maybe we shouldn't perform any transforms on the fragment if the uri isn't local? I don't use the table of contents so I'm not too sure about this one.

I think in the meantime I'm going to revert 0.4.2 until this is sorted out.

@djeremiah
Copy link
Contributor Author

Ah nuts, I didn't think about that, was focused on fixing up the generated links.

It's a tricky one, because there's no way to tell the difference between a markdown link that's been generated by vimwiki and one that's been handwritten. I think it's safe to do inside the vimwiki_markdown_file_exists? block, since that virtually guarantees it's a vimwiki link. For the fragment-only case, I'm not sure.

I can live without the generated TOC, so maybe that could be deferred. I've updated my feature branch to reflect this approach.

@patrickdavey
Copy link
Owner

I'm happy to do it myself, but, if you have time, can you rebase your branch against master (as I reverted your changes) and then open a new PR? I'm off to bed here anyway (NZ!), so, I'll get to this tomorrow :)

I think the idea of just doing it inside the local block seems sensible. Can always do that until we get an issue telling us we broke stuff. Hurrah for never reaching 1.0 ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants