DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:maplink

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
plugin:maplink [2021-05-01 23:43] – [Development] chlwplugin:maplink [2021-05-02 00:13] (current) chlw
Line 4: Line 4:
 description: Links an address or other search text directly to Google maps description: Links an address or other search text directly to Google maps
 author     : chlw  author     : chlw 
-email      : chlw@dataway.ch +email      : none
 type       : Syntax type       : Syntax
-lastupdate : 2013-12-26 +lastupdate : 2021-05-01 
-compatible : Adora Belle, Weatherwax, Binky+compatible : Adora Belle, Weatherwax, Binky, Hogfather
 depends    :  depends    : 
 conflicts  conflicts 
Line 13: Line 13:
 tags       : links, maps tags       : links, maps
  
-downloadurl: http://stuff.chlw.ch/stuff/dokuwiki/maplink/maplink.zip+downloadurl: http://stuff.eldach.ch/stuff/dokuwiki/maplink/maplink.zip
 bugtracker :  bugtracker : 
 sourcerepo :  sourcerepo : 
Line 50: Line 50:
     }     }
  
-    function handle($match, $state, $pos, &$handler) {+    function handle($match, $state, $pos, Doku_Handler $handler) {
         return explode(':', substr($match, strlen('{{maplink:'), -2));         return explode(':', substr($match, strlen('{{maplink:'), -2));
     }     }
    
-    function render($mode&$renderer, $data) { +    function render($formatDoku_Renderer $renderer, $data) {
-      //  $renderer->doc .= '<a href="' .htmlspecialchars($data[0]) . '">' .htmlspecialchars($data[1]) . '</a>'; +
-        +
         $renderer->doc .= '<a href="http://maps.google.com/maps?q='.str_replace(' ', '+', str_replace(',', ' ', $data[0])). '"target="_blank">' .htmlspecialchars($data[1]) . '</a>';         $renderer->doc .= '<a href="http://maps.google.com/maps?q='.str_replace(' ', '+', str_replace(',', ' ', $data[0])). '"target="_blank">' .htmlspecialchars($data[1]) . '</a>';
     }     }
Line 95: Line 93:
 </code> </code>
  
 +\\ \\ 
 +Tip: You might want to include the words "route planner, Routenplaner, Anfahrt" or similar in your language in your search. Depending on your actual position Google Maps opens directly in the route planner mode (which is a bit scary... ;-):
 +
 +<code>{{maplink:The Peninsula Hotel route planner, Bangkok:Five Star Hotel in Thailand}}
 +</code>
 +\\ \\ 
 === Screenshots === === Screenshots ===
  
-{{http://stuff.chlw.ch/stuff/dokuwiki/maplink/snap_001.gif?200x200&direct |Link in Action}}+{{http://stuff.eldach.ch/stuff/dokuwiki/maplink/snap_001.gif?200x200&direct |Link in Action}}
  
-{{http://stuff.chlw.ch/stuff/dokuwiki/maplink/snap_002.gif?200x200&direct |Example Code}}+{{http://stuff.eldach.ch/stuff/dokuwiki/maplink/snap_002.gif?200x200&direct |Example Code}}
  
-\\ \\ +\\ \\ \\ 
  
 ===== Configuration and Settings ===== ===== Configuration and Settings =====
Line 124: Line 128:
 None, so far. None, so far.
  
-=== ToDo/Wish List ===+=== ToDo / Wish List / Questions===
  
   * Could this be coded in a more clever way?   * Could this be coded in a more clever way?
   * Does this code really cover all possible cases? I tried it with some Thai text and, no surprise, it did not work.   * Does this code really cover all possible cases? I tried it with some Thai text and, no surprise, it did not work.
 +  * The link does not appear on the same line but on a separate next line / paragraph if you have a code like:\\ <code>Location of the fiesta: {{maplink:Playa del Sol Hotel Cancun Mexico:Playa del Sol -- my favourite place}}</code>Any hints on that...?
 +
  
  
plugin/maplink.1619905423.txt.gz · Last modified: 2021-05-01 23:43 by chlw

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki