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

Removes restrictions in viewport names #271

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nkakouros
Copy link
Contributor

In the regexp that handle viewports, there is the restriction on header names to not include the ] or } characters. I couldn't see why this restriction is in place as the | is what actually matters.

This PR removes the restriction. It means to address #256 .

@liskin
Copy link
Collaborator

liskin commented Jul 21, 2020

The restriction is there because vimwiki links may contain |: https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a6415a4f83847752928252d/doc/vimwiki.txt#L996

It's definitely possible to write a regexp that handles this, but it's going to be more complex than the current one. Several options come to my mind:

  1. keep the [^=\|\[\{]* and add an alternative that recognizes [[ and then eats everything until ]]
  2. use a negative look-ahead assertion (\@!) to make sure that the | isn't followed by ]]
  3. require spaces around the | as vimwiki links are unlikely to contain spaces around their |

The third option is definitely the easiest, but I have no idea if that would be acceptable to @tbabej. It's also the one that is most likely to break some users' usecases.

Either way, now that the tests are working and fast, it would be a good idea to add a few tests covering the various scenarios.

@nkakouros
Copy link
Contributor Author

I went with the simplest approach.

@nkakouros
Copy link
Contributor Author

I also fixed markdown links not being followed. This is ready to merge if you have no comments.

taskwiki/regexp.py Outdated Show resolved Hide resolved
@nkakouros
Copy link
Contributor Author

@tbabej Friendly reminder that this seems ready to merge.

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.

3 participants