CMSModeAddLink

Summary: An AddLink Bookmarklet recipe: (:AddLink:)
Version: 2016-09-14
Prerequisites: >=PmWiki 2.1.x
Status: Beta
Maintainer: Hagan Fox
Categories: CMS, PageDirectives, PHP55
Users: (view? / edit)

Questions answered by this recipe

How can I easily add pre-marked-up links to wiki pages using a bookmarklet.

Description

Add links to wiki pages using a bookmarklet.

Files

 cookbook/
 |-- cmsb-addlink.php
  `- cmsb-addlink-README.txt

Installation

Unpack the archive in your cookbook directory and add this to your configuration file (e.g. config.php):

##  Enable the AddLink Bookmarklet recipe.
if (preg_match('/^(edit|browse|addlink|logout)$/', $action)) {
  @include_once("$FarmD/cookbook/cmsb-addlink.php"); }

Configuration

Configuration is optional. There are four settings.

##  Enable the AddLink Bookmarklet recipe.
# $AddLinkText ="$[Add a link to ]".$pagename; // link text
# $AddLinkTitle ="$[AddLink Bookmarlket]";     // tooltip
# $EnableAddLinkTitleStyle = 1; // Use a heading rather than a definition.
# $EnableAddLinkToEnd = 1;      // Place the link at the end of the page.
if (preg_match('/^(edit|browse|addlink|logout)$/', $action)) {
  @include_once("$FarmD/cookbook/cmsb-addlink.php"); }

Usage

TL;DR

  • Bookmark the link, then go to a page and click the bookmark.
  • Optionally you can highlight some text in the page before clicking the bookmark.

Details

This recipe creates an "add link" bookmarklet that makes it easy save web site links in your wiki. It works like this:

Your browser will be taken to your site in edit mode. By default the page's title will become a definition term and the text you highlighted will become the definition for the term. A bookmark for pmwiki.org has markup that looks like this

:[[http://www.pmwiki.org/wiki/Cookbook/CMSBundle|PmWiki | Cookbook / CMSBundle]]:Some scripts that add features useful for a CMS-type installation.

and renders like this

PmWiki | Cookbook / CMSBundle
Some scripts that add features useful for a CMS-type installation.

Optionally you can have the recipe create "heading style" (a.k.a. Herber style) markup that looks like this

!!!PmWiki | Cookbook / CMSBundle

http://www.pmwiki.org/wiki/Cookbook/CMSBundle

Some scripts that add features useful for a CMS-type installation.

and renders like this

PmWiki | Cookbook / CMSBundle

http://www.pmwiki.org/wiki/Cookbook/CMSBundle

Some scripts that add features useful for a CMS-type installation.

Notes

This is a fork of an old version of the AddLinkBookmarklet? recipe, which at the time seemed unmaintained and overlooked. At this point it's significantly different from the original.

Despite the name, this is a stand-alone script. Other recipes from CMS Bundle are not required.

Change log / Release notes

  • 2015-11-06 - The browser sniffing now smells newer browsers. Also now escaping the vertical-bar character in URLs.
  • 2016-09-16: Some cleanup + added a setting so the link text and the link title (tooltip) are separate settings ($AddLinkText and $AddLinkTitle respectively). Moved README text to a separate file and bundled as an archive you can unpack from the cookbook/ directory.

See also

Contributors

Comments

See discussion at CMSModeAddLink-Talk?

Page last modified on September 15, 2016
Powered by PmWiki