Loading ...
Sorry, an error occurred while loading the content.

Custom links e.g. lastfm:

Expand Messages
  • helgeko
    Hi! If anyone needs to custom links from WikidPad, tell me, I will tell you how. I use it to collect my http://last.fm -favorite stations, like
    Message 1 of 3 , Oct 18, 2008
    View Source
    • 0 Attachment
      Hi!

      If anyone needs to custom links from WikidPad, tell me, I will tell
      you how.

      I use it to collect my http://last.fm -favorite stations, like
      lastfm://globaltags/trip-hop

      :) Helge

      http://twitter.com/HelgeM
    • helgeko
      OK, then here it goes: I am anything but good in this, but it works for me. You need to go to your WikidPadGlobals-directory. Find it by going to WikidPad s
      Message 2 of 3 , Oct 18, 2008
      View Source
      • 0 Attachment
        OK, then here it goes:

        I am anything but good in this, but it works for me.

        You need to go to your WikidPadGlobals-directory.

        Find it by going to WikidPad's menu, into "Help" and there into
        "About". Scroll down and it says "Your configuration directory is:".
        In the path given there your will find your a directory
        "WikidPadGlobals" (or ".WikidPadGlobals" on Linux?).

        If it is not there create the directory "user_extensions". In there
        create the file "WikiSyntax.py".

        Put the following in there:
        #--- cut start ---

        import locale
        import string

        import pwiki.srePersistent as re
        from pwiki.StringOps import mbcsDec

        UrlRE =
        re.compile(ur'(?:(?:wiki|https?|ftp|rel|lastfm)://|mailto:|Outlook:\S|file://?)'
        ur'(?:(?![.,;:!?)]+["\s])[^"\s<>])*(?:>\S+)?',
        re.DOTALL | re.UNICODE | re.MULTILINE) # SPN

        InTitledUrlPAT = (ur'((?:(?:wiki|https?|ftp|rel)://|mailto:|'
        ur'Outlook:\S|file://?|lastfm:)(?:(?![.,;:!?)]+["\s])[^"\s<>])*(?:>\S+)?)|'
        ur'((?:(file|rel|lastfm)://?(?:(?![.,;:!?)]+")[^"<>\]])*(?:>[^\s\]]+)?))')

        #--- cut end ---

        See the "lastfm"'s in there? You could replace them with what link you
        need. Or add more one with a "|" in between. Probably I put "lastfm"
        in one or two places to much because I have not worked my way through
        the whole expression... but it works.

        You need to restart WikidPad for this to take effect.

        I cross posted this to
        http://apps.sourceforge.net/mediawiki/wikidpad/index.php?title=Custom_hyperlink_formats_(e._g._lastfm)_in_WikidPad
        for later reference.

        :) Helge

        http://tinyurl.com/HelgeProfil
      • f.savard
        That s a cute hack. I wanted some quick way shortcut to my documents (instead of typing the whole path all the time), so I think I ll use something like this
        Message 3 of 3 , Oct 18, 2008
        View Source
        • 0 Attachment
          That's a cute hack. I wanted some quick way shortcut to my documents
          (instead of typing the whole path all the time), so I think I'll use
          something like this (doc://...).

          On the other hand, in order for the links to work I think it'd be
          useful to add something to url processing. For the lastfm case, I
          added this to the lib/pwiki/PersonalWikiFrame.py > launchUrl function:

          elif link.startswith(u"lastfm://"):
          link = "http://www.last.fm/listen/" + link[9:]

          (just after this:
          if link.startswith(u"rel://"):
          # This is a relative link
          link = self.makeRelUrlAbsolute(link)
          )

          Worked both in preview and edit mode for me.

          Fran├žois
          http://www.fsavard.com/flow

          --- In wikidPad@yahoogroups.com, "helgeko" <helgehelge@...> wrote:
          >
          > OK, then here it goes:
          >
          > I am anything but good in this, but it works for me.
          >
          > You need to go to your WikidPadGlobals-directory.
          >
          > Find it by going to WikidPad's menu, into "Help" and there into
          > "About". Scroll down and it says "Your configuration directory is:".
          > In the path given there your will find your a directory
          > "WikidPadGlobals" (or ".WikidPadGlobals" on Linux?).
          >
          > If it is not there create the directory "user_extensions". In there
          > create the file "WikiSyntax.py".
          >
          > Put the following in there:
          > #--- cut start ---
          >
          > import locale
          > import string
          >
          > import pwiki.srePersistent as re
          > from pwiki.StringOps import mbcsDec
          >
          > UrlRE =
          >
          re.compile(ur'(?:(?:wiki|https?|ftp|rel|lastfm)://|mailto:|Outlook:\S|file://?)'
          > ur'(?:(?![.,;:!?)]+["\s])[^"\s<>])*(?:>\S+)?',
          > re.DOTALL | re.UNICODE | re.MULTILINE) # SPN
          >
          > InTitledUrlPAT = (ur'((?:(?:wiki|https?|ftp|rel)://|mailto:|'
          >
          ur'Outlook:\S|file://?|lastfm:)(?:(?![.,;:!?)]+["\s])[^"\s<>])*(?:>\S+)?)|'
          >
          ur'((?:(file|rel|lastfm)://?(?:(?![.,;:!?)]+")[^"<>\]])*(?:>[^\s\]]+)?))')
          >
          > #--- cut end ---
          >
          > See the "lastfm"'s in there? You could replace them with what link you
          > need. Or add more one with a "|" in between. Probably I put "lastfm"
          > in one or two places to much because I have not worked my way through
          > the whole expression... but it works.
          >
          > You need to restart WikidPad for this to take effect.
          >
          > I cross posted this to
          >
          http://apps.sourceforge.net/mediawiki/wikidpad/index.php?title=Custom_hyperlink_formats_(e._g._lastfm)_in_WikidPad
          > for later reference.
          >
          > :) Helge
          >
          > http://tinyurl.com/HelgeProfil
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.