"Quality is the parent, the source of all subjects and objects." - Robert Pirsig

Fits Observation: Henry Gurr’s How Our Mind Works


Henry S Gurr’s Article, Book, & Mind-Map, Projects


SiteMaster Henry S Gurr’s Earth Friendly Projects:


SiteMaster Henry S Gurr’s Tech Corner & Projects:



ZMMQuality WebSite: Information Concerning
*** Zen and the Art of ***
Motorcycle Maintenance
** by Robert Pirsig **

Home Page: Fors ZMM Quality WebSite
News&NewsArchive: Re Robert Pirsig & Book
ZMM Book (Full Text) Free On Internet



SUMMARY=>How Find Way In This ZMMQ Site


SUMMARY=> Robert Pirsig Zen Art Motorcycle Maint.


Celebrate: Robert Pirsig’s July1968 Motorcycle Trek


SUMMARY=>Experts & Readers Provide Guidance


SUMMARY=>SpecialStudies Zen Art Motorcycle Maint


SUMMARY=>Memories: Dennis Gary English MSU


SUMMARY=>Research Montana State UniversityMSU


SUMMARY=>“Pirsig Pilgrims”&“Fellow ZMM Travelers”

AFTER Above Link ComeUp, GoTo ''Zen and..Last Hurrah”


SUMMARY=>Maps+Info: ZMM Travel & Mountain Climb


Resources: Pirsig & Zen Art of Motorcycle Maint.


SUMMARY=>Software&Hardware: Create This WebSite


Thanks To Persons Who Created & Supported ZMMQ


PLEASE NOTICE: THE FOLLOWING 4 HANDY LINKS:

ALSO PLEASE NOTICE THESE SAME 4 HANDY LINKS: BOTTOM EVERY ZMMQ PAGE


  

TO ACCESS PHOTO ALBUMS,
Click any photo below: **OR**
Mouse Hover, Over Photo, For Album Description

These 12 Photos were taken by Robert Pirsig’s very own camera, as he Chris, Sylvia and John made that 1968 epic voyage upon which The Travel Narrative for Mr Pirsig’s ‘‘Zen and the Art of Motorcycle Maintenance‘‘ (ZMM) book was based. Taken in 1968 along what is now known as ‘‘The ZMM Book Travel Route ‘‘ each photo scene is actually ‘‘Written-Into ‘‘ Mr. Pirsig’s book => ‘‘Zen and the Art of Motorcycle Maintenance‘‘ (ZMM)

Author Robert Pirsig’s Own 12 Color Photos, Of His 1968 ZMM Travel Route Trip: Each Is Written-Into His ZMM Book. AFTER the 5 Albums Cones Up, Read & ClickOn 2nd Down.

Each of the 832 photographs in these Four Albums show a scene described in the book ‘‘Zen and Art of Motorcycle Maintenance‘‘. Each photo was especially researched and photographed along the ZMM Route to show a specific ZMM Book Travel Description Passage: This passage is shown in quote marks below the respective photo. As you look at each of these photos, you will be viewing scenes similar to those that author Pirsig, Chris, and the Sutherlands might have seen, on that epic voyage, upon which the book ‘‘Zen and the Art of Motorcycle Maintenance‘‘ was based. Thus it is, that these 832 photographs are ‘‘A Color Photo Illustrated Zen and Art of Motorcycle Maintenance‘‘. Indeed ‘‘A Photo Show Book‘‘ for ZMM. Sights & Scenes Plus Full Explanation.

My ZMM Travel Route Research Findings, Are A Page-By-Page, Color Photo Illustrated ZMM. AFTER the 5 Albums Cones Up, Read & ClickOn Top Album.

Each of these 28 photos are Full Circle Panorama Photos Seven-Feet-Wide. They were taken along the Travel Route of the book ‘‘Zen and the Art of Motorcycle Maintenance‘‘. They show a 360 degree view, made by stitching together eight photos. These Panoramic Photos, complement and add to those of my Photo Album ABOVE named  => ‘‘A Color Photo Illustrated ZMM Book, With Travel Route Sights & Scenes Explained‘‘.

ZMM Travel Route Research PANORAMIC PHOTOS 7ft wide! Henry Gurr, 2002 ZMM Research Trip. AFTER the 5 Albums Cones Up, Read & ClickOn 2nd Down.

This album shows what I saw  on my RETURN trip home (San Francisco California to Aiken South Carolina), Summer 2002. These 55 photos were taken along the Route of the “1849er’s Gold Rush to California” (In Reverse Direction). After I completed my ZMM Research, I RETURNED home by way of the Route of the ‘49’s Gold Rush. This route included the route of the “California Gold Rush Trail” (in Nevada & California), as well as portions of the Oregon Trail' all the way into Missouri. These 1849er’s Travel Route Photos, were taken AFTER I took those Photos shown in the above Album named “A Color Photo Illustrated ZMM Book, With Travel Route Sights & Scenes Explained”.

Henry Gurr’s 2002 Research Photos: California Gold Rush Trail & Oregon Trail. AFTER the 5 Albums Cones Up, Read & ClickOn 3rd Down.

Each of these seven 360 degree  Full Circle Panoramic Photos were taken along the route of the Gold Rush ‘1849’ers from Missouri to California. Each is 7 foot wide! These Panorama Photos complement and add to those of my Photo Album above named  => "Henry Gurr’s Research Photos: California Gold Rush Trail & Pioneer Oregon Trail".   AFTER the 5 Albums Cones Up, Read & ClickOn Top Album.

California Gold RushTrail & Pioneer Oregon Trail PANORAMIC PHOTOS 7ft wide! Henry Gurr, 2002 ZMM RETURN Trip. AFTER the 5 Albums Cones Up, Read & ClickOn Top Album.

Enjoy 225 Photos of Flowers & Red Wing Blackbirds Along the ZMM Route. This Album of  Color Photos shows every Flower and Red Wing Blackbird (RWBB) that I could “get within my camera sights!!”  This was done in honor of the ZMM Narrator's emphasis of Flowers and Redwing Blackbirds in the book “Zen and the Art of Motorcycle Maintenance”. I was very surprised to find RWBB's the entire travel route from Minneapolis to San Francisco.

In Honor of ZMM Narrator’s Emphasis: 225 Color Photos of ZMM Travel Route Flowers & Red Wing Blackbirds. AFTER the 5 Albums Cones Up, Read & ClickOn 5th Down.

These 165 photos show ‘‘Tourist Experiences’‘ the ZMM Traveler may have along the ZMM Route.

My 2002 ZMM Travel Route Experience: By Henry Gurr ZMMQ Site Master. AFTER the 5 Albums Cones Up, Read & ClickOn 3rd Down.

Starting Monday 19 July 2004, Mark Richardson traveled the ZMM Route, on his trusty Jakie Blue motorcycle. Mark made these 59 interesting photographs of what he saw along the way. As he toured, he pondered his own life destiny (past present future), and sought to discover his own deeper personal meaning of the book “Zen and the Art of Motorcycle Maintenance”.

Mark Richardson’s 19 July 2004, ZMM Route Trip & Photo Journal. AFTER the 5 Albums Cones Up, Read & ClickOn 5th Down.

The former home (~1968) of John and Sylvia Sutherland, at 2649 South Colfax Ave, Minneapolis MN, shown in 18 photos. Despite John's quite negative disparaging statements in ZMM, about their home back in Minneapolis, this same house, shown in these photos, looks to us like a wonderful, beautiful home along a very nice, quiet, shady street, in a perfectly fine Minneapolis Neighborhood!

John & Sylvia Sutherland of “The ZMM Book”: 18Potos Of Former Minneapolis Home>2649 South Colfax Ave, AFTER the 5 Albums Cones Up, Read & ClickOn 4th Down.

A 36 Photo Tour of Two University of South Carolina Buildings:  a) Etherredge Performing Arts Center Lobby + b) Ruth Patrick Science Education Center, some of which show “Built In Educational Displays

Site Master Henry Gurr's Campus: Photos Of Two Buildings (of 32 total), University of South Carolina Aiken. AFTER the 5 Albums Cones Up, Read & ClickOn 2nd Down.

A 105 Photo Tour of Science Building
At The University of South Carolina Aiken, Aiken SC.
Also showing a) Flowers & Exotic Plants In The Greenhouse
And b) The Rarely Seen Equipment Service Room & Dungeon.
Site Master Henry Gurr's Campus: Photos Of Science Building, One (of 32 total Buildings) At The University of South Carolina Aiken. AFTER the 5 Albums Comes Up, Read & ClickOn 5th Down.

IThese 15 photos show persons & scenes, related to how we got this ZMMQ WebSite going, back in ~2002. Included are "screen captures" of our software systems in use. A few of these photos show the screen views of what we were “looking at,” some including brief notes & hints on how to get around some of the problems we experienced.

Software We Used ~2002, In Creating and Maintaining This ZMMQ WebSite: Illustrated & Explained. AFTER the 5 Albums Cones Up, Read & ClickOn Top Albun.

Attach:ZmmqWikiThumbForWikiMenuLinkToMscFacPixPg2.jpg Δ
1947-60: Photos of MSC Faculty & Sarah Vinke (Vinki Vinche Finche Finch)


In Hawaiian WIKI MEANS => Quick N’ Easy N’ Better! For Anything You Do!!
Wikis began 1994, Ward Cunningham gave name "WikiWikiWeb"..Cont Heret
UP-TO-DATE INFORMATION & HOW TO USE pmWiki
The Pages You Are NOW Reading, Are Powered By pmWiki WebSite SftWare:


ZMMQ Site => Various UN-Complete Work In Process



Revised}DaveMatos130715+HenryGurr140227;16036;170214;180920;181127,200217,200312, 200318, 200831, 210626, 220508,220926,240209-12 , 240319-21, 240530, 240915, 241220.--]
File = WikiZmmq)MenuSidebar.CuzWantPreservPrev240914CpyFnServerServAgain01+FxNgLinks3.docx
PrevFile = WikiZmmq)MenuSidebar.CuzWantPreservPrev240914CpyFnServerServAgain01+FxNgLinks2.docx
PrevFile = WikiZmmq)MenuSidebar..BecuzPrevSvAsNg 240319CpyFnServer07)CpyFmServAgain01.docx
PrevFile = WikiZmmq)MenuSidebar..BecuzPrevSvAsNg 2403`9CpyFnServer07.docx
PrevFile = WikiZmmq)MenuSidebar..200217..210626..220508EdtSvd+Fx&AddLine13+Rev1.docx
File = WikiZmmq)MenuSidebar..200217..210626..220508EdtSvd+Fx&AddLine12.docx
PrevFile = WikiZmmq)MenuSidebar..200217..210626..220508EdtSvd,doc.Hsg02.docx
PrevFile = WikiZmmq)MenuSidebar..FaFaFa200217.06Fa200830Fa210626.Hsg01.doc




administrators (intermediate)

Introduction

PmWiki's markup translation engine is handled by a set of rules; each rule searches for a specific pattern in the markup text and replaces it with some replacement text. Internally, this is accomplished by using PHP's "preg_replace" function.

Rules are added to the translation engine via PmWiki's Markup() or Markup_e() functions, which look like

Markup($name, $when, $pattern, $replace); # if no evaluation is needed, or if PHP < 5.5
Markup($name, $when, $pattern, $replace_function); # if evaluation is needed

# DEPRECATED, will not work as of PHP 7.2
Markup_e($name, $when, $pattern, $replace); # if evaluation is needed and 5.5<=PHP<=7.1
  • $name is a unique name (a string) given to the rule
  • $when says when the rule should be applied relative to other rules
  • $pattern is the pattern to be searched for in the markup text
  • $replace is what the pattern should be replaced with.
  • $replace_function is the name of the function which should be called with the match, and should return the replacement.

For example, here's the code that creates the rule for ''emphasized text'' (in scripts/stdmarkup.php):

Markup("em", "inline", "/''(.*?)''/", "<em>$1</em>");

Basically this statement says to create a rule called "em" to be performed with the other "inline" markups, and the rule replaces any text inside two pairs of single quotes with the same text ($1) surrounded by <em> and </em>.

Sequence in which rules are applied

The first two parameters to Markup() are used to specify the sequence in which rules should be applied. The first parameter provides a name for a rule -- "em" in the example above. We could've chosen other names such as "''", or even "twosinglequotes". In general PmWiki uses the markup itself to name the rule (i.e., PmWiki uses "''" instead of "em"), but to keep this example easier to read later on we'll use a mnemonic name for now.

The second parameter says that this rule is to be done along with the other "inline" markups. PmWiki divides the translation process into a number of phases:

  _begin      start of translation
    {$var}    Page Text Variables happen here.
  fulltext    translations to be performed on the full text            
  split       conversion of the full markup text into lines to be processed
  directives  directive processing
  inline      inline markups
  links       conversion of links, url-links, and WikiWords     
  block       block markups
  style       style handling       
  _end        end of translation

This argument is normally specified as a left-angle bracket ("before") or a right-angle bracket ("after") followed by the name of another rule.

Thus, specifying "inline" for the second parameter says that this rule should be applied when the other "inline" rules are being performed. If we want a rule to be performed with the directives -- i.e., before inline rules are processed, we would specify "directives" or "<inline" for the second parameter.

{$var} and (:if ...:) conditionals

A significant rule in terms of ordering is "{$var}" which substitutes variables -- if you say "<{$var}" then your markup will be processed before variables are substituted whereas if you say ">{$var}" then your markup will be processed after variables are substituted. This happens before conditional (:if...:) expressions, which is why page text variables are processed even if they are defined inside (:if false:).

Markup regular expression definition

The third parameter is a Perl-compatible regular expression. Basically, it is a slash, a regular expression, another slash, and a set of optional modifiers.

The example uses the pattern string "/''(.*?)''/", which uses ''(.*?)'' as the regular expression and no options. (The regular expression says "find two single quotes in succession, then as few arbitrary characters as are needed to make the match find something, then two additional single quotes in succession"; the parentheses "capture" a part of the wikitext for later use.)

Replacement text

The fourth parameter is the replacement text that should be inserted instead of the marked-up wikitext. You can use $1, $2, etc. to insert the text from the first, second etc. parenthesised part of the regular expression.

In the example, we have "<em>$1</em>", which is an <em>, the text matched by the first parentheses (i.e. by the .*? section of the pattern), and </em>.

Here's a rule for @@monospaced@@ text:

Markup("@@", "inline", "/@@(.*?)@@/", "<code>$1</code>");

and for a [:comment ...:] directive that is simply removed from the output:

Markup("comment", "directives", "/\\[:comment .*?:\\]/", '');

Okay, now how about the rule for '''strong emphasis'''? We have to be a bit careful here, because although this translation should be performed along with other inline markup, we also have to make sure that the rule for ''' is handled before the rule for '', because ''' also contains ''. The second parameter to Markup() can be used to specify the new rule's relationship to any other rule:

Markup("strong", "<em", "/'''(.*?)'''/", "<strong>$1</strong>");

This creates a rule called "strong", and the second parameter "<em" says to be sure that this rule is processed before the "em" rule we defined above. If we wanted to do something after the "em" rule, we would use ">em" instead. Thus, it's possible to add rules at any point in PmWiki's markup translation process in an extensible manner. (In fact, the "inline", "block", "directives", etc., phases above are just placeholder rules used to provide an overall sequence for other rules. Thus one can use "<inline" to specify rules that should be handled before any other inline rules.)

If you want to disable available markup just call e.g.:

DisableMarkup("strong");

PmWiki's default markup rules are defined in the scripts/stdmarkup.php file. To see the entire translation table as the program is running, the scripts/diag.php module adds "?action=ruleset", which displays the set of defined markup rules in the sequence in which they will be processed. You can see it at CustomMarkup?action=ruleset. You must first enable the action by setting $EnableDiag = 1 in your configuration file.

Other common examples

Define a custom markup to produce a specific HTML or Javascript sequence

Suppose an admin wants to have a simple "(:example:)" markup that will always produce a fixed HTML string in the output, such as for a webring, Google AdSense display, or Javascript. The Markup() call to do this would be:

Markup('example', 'directives',
  '/\\(:example:\\)/',
  Keep("<div class='example'><p>Here is a 
    <a target='_blank' href='http://www.example.com'>link</a> to
    <em>example.com</em></p></div>") );
  • The first argument is a unique name for the markup ("example").
  • The second argument says to perform this markup along with other directives.
  • The third argument is the pattern to look for "(:example:)".
  • The fourth argument is the HTML that "(:example:)" is to be replaced with. We use the Keep() function here to prevent the output from being further processed by PmWiki's markup rule -- in the above example, we don't want the http://www.example.com url to be again converted to a link.

Define a markup to call a custom function that returns content

The /e modifier has been deprecated and should not be used in ongoing development. See below for more details.

For older PHP versions (< 7.2) an 'e' option on the $pattern parameter causes the $replace parameter to be treated as a PHP expression to be evaluated instead of replacement text. To avoid using the deprecated e/ parameter, a markup to produce a random number between 1 and 100 might now look like:

Markup('random', 'directives',
  '/\\(:random:\\)/',
  "MyRandomFunction");
function MyRandomFunction() {
  return rand(1, 100);
}

This calls the PHP built-in rand() function and substitutes the directive with the result. Any function can be called, including functions defined in a local customization file or in Cookbook recipes.

Arguments can also be passed by using regular expression capturing parentheses, thus

Markup('randomargs', 'directives',
  '/\\(:random (\\d+) (\\d+):\\)/',
  "MyRandomFunction");
function MyRandomFunction($m) {
  return rand($m[1], $m[2]);
}

will cause the markup (:random 50 100:) to generate a random number between 50 and 100.

Note: the /e modifier in regular expressions is deprecated since PHP version 5.5, and removed since PHP version 7. The reason for this is, that malicious authors could pass strings that could cause arbitrary and undesirable PHP functions to be executed.

For a PmWiki function to help with parsing arbitrary sequences of arguments and key=value pairs, see Cookbook:ParseArgs.

Migration to PHP 5.5 and Markup_e()

Since PHP version 5.5, the /e evaluation modifier is deprecated and some hosting providers don't allow its use.

Recent versions of the PmWiki core (2.2.58 and newer) allow new ways to define markup rules without being dependent on the /e eval modifier. The historical ways to define markup rules are not removed and work, but may be incompatible with PHP 5.5 installations.

Note: whether your replacement pattern needs evaluation or not, you must use Markup() and not Markup_e(). The latter is deprecated and should no longer be used for new recipes and customizations, and old recipes using Markup_e should be upgraded to the new format.

The examples below all require PmWiki 2.2.58 (2013-12-25) or newer but the latest version is recommended.

THE SHORT ANSWER: If your markup regular expression (the 3rd argument) contains an "e" after the closing slash (i.e., /regex/e or /regex/se or etc) AND your 4th argument is entirely surrounded with double-quotes then you may be able to get away with simply following these simple steps:

  1. Delete the "e" from after the closing slash in the 3rd argument
  2. Create a new replacement function with $m as argument.
  3. In your function, the previous occurrences of '$1', '$2', etc. are now found as $m[1], $m[2], etc. You should no longer need to call PSS().
  4. In your function, call extract($GLOBALS['MarkupToHTML']); in order to get the current $pagename and $markupid.
  5. Set the name of the replacement function as 4th argument of the Markup() call.

In some cases this will not suffice - it depends on how quoting was done - but in many cases following these simple steps will result in PHP 5.5+ compatibility.

If you try those steps and are still having problems then continue to read below for a deeper understanding.

The following is acceptable for PHP 5.5+ (compatible with PmWiki 2.2.58+, will also work in PHP 5.4 and older)

  • Markup($name, $when, $pattern, $replace);
    • $pattern can no longer have an "/e" modifier
    • $replace can be a function name (callback) which will be called with the array of matches as argument
    • instead of a string, the fourth parameter can be a definition of an anonymous function (note you can use anon functions this way since PHP 5.3.0+).
  • Markup_e($name, $when, $pattern, $replace); DEPRECATED, should no longer be used

Examples:

  • For PHP 5.4 and older, this was acceptable:
    Markup('randomargs', 'directives',
      '/\\(:random (\\d+) (\\d+):\\)/e',
      "rand('$1', '$2')"
      );
  • For PHP 5.5 and newer, $replace is callback, we call Markup():
    Markup('randomargs', 'directives',
      '/\\(:random (\\d+) (\\d+):\\)/',
      "MyRandom"
      );
    function MyRandom($m) { # $m = matches
      return rand($m[1], $m[2]);
    }
    

    This will also work in PHP 5.4 and older

Other example:

  • PHP 5.4 or older:
    Markup('Maxi:','<links',
      "/\\b([Mm]axi:)([^\\s\"\\|\\[\\]]+)(\"([^\"]*)\")?/e",
      "Keep(LinkMaxi(\$pagename,'$1','$2','$4','$1$2'),'L')"
      );
    
  • PHP 5.5 or newer, PmWiki 2.2.58+, $replace is a function name:
    Markup('Maxi:','<links',
      "/\\b([Mm]axi:)([^\\s\"\\|\\[\\]]+)(\"([^\"]*)\")?/",
      "LinkMaxi"
      );
    function LinkMaxi($m) {
      extract($GLOBALS['MarkupToHTML']); # to get $pagename
      # do stuff with $m[1], $m[2], etc.
      return Keep($out, 'L');
    }
    

    This will also work in PHP 5.4 and older
  • $replace can also be a callback function, we call Markup():
    Markup('Maxi:','<links',
      "/\\b([Mm]axi:)([^\\s\"\\|\\[\\]]+)(\"([^\"]*)\")?/",
      "CallbackMaxi"
    );
    function CallbackMaxi($m) {
      extract($GLOBALS["MarkupToHTML"]); # to get $pagename
      return Keep(LinkMaxi($pagename,$m[1],$m[2],$m[4],$m[1].$m[2]),'L');
    }
    

    This will also work in PHP 5.4 and older

The above may seem complicated, but it is actually simpler to use your own callback function:

Markup('mykey', 'directives', 
  '/\\(:mydirective (.*?) (.*?):\\)/i',
  'MyFunction'
);
function MyFunction($m) {
  extract($GLOBALS["MarkupToHTML"]);

  # ... do stuff with $m (the matches), drop PSS() ...

  return $out; # or return Keep($html);
}

If you have any questions about the new way to define custom markup, you can ask us at the talk page or on the mailing lists.

FAQ

How can I embed JavaScript into a page's output?

There are several ways to do this. The Cookbook:JavaScript recipe describes a simple means for embedding static JavaScript into web pages using custom markup. For editing JavaScript directly in wiki pages (which can pose various security risks), see the JavaScript-Editable recipe. For JavaScript that is to appear in headers or footers of pages, the skin template can be modified directly, or <script> statements can be inserted using the $HTMLHeaderFmt array.

How would I create a markup ((:nodiscussion:)) that will set a page variable ({$HideDiscussion}) which can be used by (:if enabled HideDiscussion:) in .PageActions?

Add the following section of code to your config.php

SDV($HideDiscussion, 0); 	#define var name
Markup('hideDiscussion', '<{$var}',
 '/\\(:nodiscussion:\\)/', 'setHideDiscussion'); 
function setHideDiscussion() { 
  global $HideDiscussion; 
  $HideDiscussion = true;
} 

This will enable the (:if enabled HideDiscussion:) markup to be used. If you want to print the current value of {$HideDiscussion} (for testing purposes) on the page, you'll also need to add the line:
$FmtPV['$HideDiscussion'] = '$GLOBALS["HideDiscussion"]';

It appears that (.*?) does not match newlines in these functions, making the above example inoperable if the text to be wrappen in <em> contains new lines.

If you include the "s" modifier on the regular expression then the dot (.) will match newlines. Thus your regular expression will be "/STUFF(.*?)/s". That s at the very end is what you are looking for. If you start getting into multi-line regexes you may be forced to look at the m option as well - let's anchors (^ and $) match not begin/end of strings but also begin/end of lines (i.e., right before/after a newline). Also make sure your markup is executed during the fulltext phase.

How can the text returned by my markup function be re-processed by the markup engine?

If the result of your markup contains more markup that should be processed, you have two options. First is to select a "when" argument that is processed earlier than the markup in your result. For example, if your markup may return [[links]], your "when" argument could be "<links" and your markup will be processed before the links markup. The second option is to call the PRR() function in your markup definition or inside your markup function. In this case, after your markup is processed, PmWiki will restart all markups from the beginning.

How do I get started writing recipes and creating my own custom markup?

(alternate) Introduction to custom markup for Beginners

How do I make a rule that runs once at the end of all other rule processing?

Use this statement instead of the usual Markup() call:

$MarkupFrameBase['posteval']['myfooter'] = "\$out = onetimerule(\$out);";



This page may have a more recent version on pmwiki.org: PmWiki:CustomMarkup, and a talk page: PmWiki:CustomMarkup-Talk.

Recent Changes (All) | Edit Sidebar | Wiki Help | Page History | Edit Page Powered by PmWiki