Skip to main content
Finally fixed the remaining ‘%:link’
Source Link
aaa
  • 486
  • 3
  • 10

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%:link][%[[%c][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%c\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

Also, removing extensions can be messy: considering that the web doesn't impose any requirements for extensions to be there, people are free to use all kinds of addresses, including ones with a dot and some word at the end. E.g. Wikipedia's page of https://en.wikipedia.org/wiki/.com. These will be stripped from the description by the brute approach. Perhaps you'll want to remove just some known extensions—for that, replace [a-z0-9]+ in the second regex with something like \(html\|php\|cfm\) etc. Again, the backslashes need to be there. To switch off the removal of extensions altogether, replace the second (replace-regexp-in-string ...) with just \"%c\".

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%:link][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%c\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

Also, removing extensions can be messy: considering that the web doesn't impose any requirements for extensions to be there, people are free to use all kinds of addresses, including ones with a dot and some word at the end. E.g. Wikipedia's page of https://en.wikipedia.org/wiki/.com. These will be stripped from the description by the brute approach. Perhaps you'll want to remove just some known extensions—for that, replace [a-z0-9]+ in the second regex with something like \(html\|php\|cfm\) etc. Again, the backslashes need to be there. To switch off the removal of extensions altogether, replace the second (replace-regexp-in-string ...) with just \"%c\".

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%c][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%c\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

Also, removing extensions can be messy: considering that the web doesn't impose any requirements for extensions to be there, people are free to use all kinds of addresses, including ones with a dot and some word at the end. E.g. Wikipedia's page of https://en.wikipedia.org/wiki/.com. These will be stripped from the description by the brute approach. Perhaps you'll want to remove just some known extensions—for that, replace [a-z0-9]+ in the second regex with something like \(html\|php\|cfm\) etc. Again, the backslashes need to be there. To switch off the removal of extensions altogether, replace the second (replace-regexp-in-string ...) with just \"%c\".

deleted 8 characters in body
Source Link
aaa
  • 486
  • 3
  • 10

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%:link][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%:link\"\"%c\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

Also, removing extensions can be messy: considering that the web doesn't impose any requirements for extensions to be there, people are free to use all kinds of addresses, including ones with a dot and some word at the end. E.g. Wikipedia's page of https://en.wikipedia.org/wiki/.com. These will be stripped from the description by the brute approach. Perhaps you'll want to remove just some known extensions—for that, replace [a-z0-9]+ in the second regex with something like \(html\|php\|cfm\) etc. Again, the backslashes need to be there. To switch off the removal of extensions altogether, replace the second (replace-regexp-in-string ...) with just \"%:link\"\"%c\".

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%:link][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%:link\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

Also, removing extensions can be messy: considering that the web doesn't impose any requirements for extensions to be there, people are free to use all kinds of addresses, including ones with a dot and some word at the end. E.g. Wikipedia's page of https://en.wikipedia.org/wiki/.com. These will be stripped from the description by the brute approach. Perhaps you'll want to remove just some known extensions—for that, replace [a-z0-9]+ in the second regex with something like \(html\|php\|cfm\) etc. Again, the backslashes need to be there. To switch off the removal of extensions altogether, replace the second (replace-regexp-in-string ...) with just \"%:link\".

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%:link][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%c\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

Also, removing extensions can be messy: considering that the web doesn't impose any requirements for extensions to be there, people are free to use all kinds of addresses, including ones with a dot and some word at the end. E.g. Wikipedia's page of https://en.wikipedia.org/wiki/.com. These will be stripped from the description by the brute approach. Perhaps you'll want to remove just some known extensions—for that, replace [a-z0-9]+ in the second regex with something like \(html\|php\|cfm\) etc. Again, the backslashes need to be there. To switch off the removal of extensions altogether, replace the second (replace-regexp-in-string ...) with just \"%c\".

added 715 characters in body
Source Link
aaa
  • 486
  • 3
  • 10

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%:link][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%:link\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

Also, removing extensions can be messy: considering that the web doesn't impose any requirements for extensions to be there, people are free to use all kinds of addresses, including ones with a dot and some word at the end. E.g. Wikipedia's page of https://en.wikipedia.org/wiki/.com. These will be stripped from the description by the brute approach. Perhaps you'll want to remove just some known extensions—for that, replace [a-z0-9]+ in the second regex with something like \(html\|php\|cfm\) etc. Again, the backslashes need to be there. To switch off the removal of extensions altogether, replace the second (replace-regexp-in-string ...) with just \"%:link\".

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%:link][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%:link\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

You probably want to add something like this:

("l" "Insert a link with a cleaned-up description" entry (file "~/Dropbox/inbox.txt")
 "* [[%:link][%(replace-regexp-in-string \"^https?://\" \"\" (replace-regexp-in-string \"\\.[a-z0-9]+$\" \"\" \"%:link\"))]]"
 :prepend t)

This removes both the protocol and the extension. However, while that should work via just one regex, for some reason org-capture's processing hiccups when it sees a pipe in the regex, and doesn't perform the replacement. So instead I have to call replace-regexp-in-string twice.

Note that all those backslashes are necessary, including the double one.

Also, removing extensions can be messy: considering that the web doesn't impose any requirements for extensions to be there, people are free to use all kinds of addresses, including ones with a dot and some word at the end. E.g. Wikipedia's page of https://en.wikipedia.org/wiki/.com. These will be stripped from the description by the brute approach. Perhaps you'll want to remove just some known extensions—for that, replace [a-z0-9]+ in the second regex with something like \(html\|php\|cfm\) etc. Again, the backslashes need to be there. To switch off the removal of extensions altogether, replace the second (replace-regexp-in-string ...) with just \"%:link\".

Source Link
aaa
  • 486
  • 3
  • 10
Loading