From 1a1e93f3750fe1754389dcb837bb345276138bd5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 21 Jul 2018 20:18:51 +0000 Subject: getmap (21jul18) git-svn-id: svn://tug.org/texlive/trunk@48243 c570f23f-e606-0410-a88d-b1316a301751 --- .../texlive/linked_scripts/getmap/getmapdl.lua | 63 +++++---- Master/texmf-dist/doc/latex/getmap/README.md | 7 +- .../texmf-dist/doc/latex/getmap/getmap-example.tex | 3 +- Master/texmf-dist/doc/latex/getmap/getmap.dtx | 155 ++++++++++++--------- Master/texmf-dist/doc/latex/getmap/getmap.pdf | Bin 2265772 -> 1957796 bytes Master/texmf-dist/doc/latex/getmap/makefile | 10 +- Master/texmf-dist/scripts/getmap/getmapdl.lua | 63 +++++---- Master/texmf-dist/tex/latex/getmap/getmap.cfg | 2 +- Master/texmf-dist/tex/latex/getmap/getmap.sty | 20 ++- 9 files changed, 189 insertions(+), 134 deletions(-) diff --git a/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua b/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua index 841574e91d7..f0f366cc433 100644 --- a/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua +++ b/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua @@ -8,9 +8,16 @@ -- -- License: LPPL -- -local http = require("socket.http"); +local http = require("socket.http") local ltn12 = require("ltn12") -local url = require("socket.url") +-- local url = require("socket.url") +-- avoid bug in luatex v1.0.7 +-- copied socket.url's escape function into local function url_escape +function url_escape(s) + return (string.gsub(s, "([^A-Za-z0-9_])", function(c) + return string.format("%%%02x", string.byte(c)) + end)) +end local OSMURL = "http://open.mapquestapi.com/staticmap/v4/getplacemap" local GMURL = "http://maps.googleapis.com/maps/api/staticmap" @@ -41,7 +48,7 @@ local KMLFILE = "" local BOUND = 0.1 local OFILE = "getmap" local QUIET = "false" -local VERSION = "v1.5 (07/10/2014)" +local VERSION = "v1.5a (2018/07/18)" function pversion() print("getmapdl.lua " .. VERSION) @@ -765,37 +772,37 @@ local UOFILE = "" local IMGURL = "" if MODE == "gm" then - ULOCATION = "center=" .. url.escape(LOCATION) + ULOCATION = "center=" .. url_escape(LOCATION) if MARKERS == "" then - UMARKERS = "&markers=size:mid|color:" .. COLOR .. "|label:" .. NUMBER .. "|" .. url.escape(LOCATION) - UZOOM = "&zoom=" .. url.escape(ZOOM) + UMARKERS = "&markers=size:mid|color:" .. COLOR .. "|label:" .. NUMBER .. "|" .. url_escape(LOCATION) + UZOOM = "&zoom=" .. url_escape(ZOOM) else - UMARKERS = "" .. url.escape(MARKERS) + UMARKERS = "" .. url_escape(MARKERS) -- correct cruft escaping of "&markers=" UMARKERS = UMARKERS:gsub("%%26markers%%3d","&markers=") UZOMM = "" if CENTER == "" then ULOCATION = "" else - ULOCATION = "center=" .. url.escape(CENTER) + ULOCATION = "center=" .. url_escape(CENTER) end end - USIZE = "&size=" .. url.escape(SIZE) - USCALE = "&scale=" .. url.escape(SCALE) - UTYPE = "&maptype=" .. url.escape(TYPE) - UIMAGETYPE = "&format=" .. url.escape(IMAGETYPE) + USIZE = "&size=" .. url_escape(SIZE) + USCALE = "&scale=" .. url_escape(SCALE) + UTYPE = "&maptype=" .. url_escape(TYPE) + UIMAGETYPE = "&format=" .. url_escape(IMAGETYPE) if IMAGETYPE == "jpg-baseline" then IMAGETYPE = "jpg" end if VISIBLE == "" then UVISIBLE = "" else - UVISIBLE = "&visible=" .. url.escape(VISIBLE) + UVISIBLE = "&visible=" .. url_escape(VISIBLE) end if IPATH == "" then UIPATH = "" else - UIPATH = "" .. url.escape(IPATH) + UIPATH = "" .. url_escape(IPATH) -- correct cruft escaping of "&path=" UIPATH = UIPATH:gsub("%%26path%%3d","&path=") end @@ -805,7 +812,7 @@ if MODE == "gm" then EPLFILE = io.open(FPATH, "r") local contents = EPLFILE:read() EPLFILE:close() - UFPATH = "" .. url.escape(contents) + UFPATH = "" .. url_escape(contents) -- correct cruft escaping of "&path=" UFPATH = UFPATH:gsub("%%26path%%3d","&path=") end @@ -817,25 +824,25 @@ if MODE == "gm" then UOFILE = OFILE .. "." .. IMAGETYPE IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. UFPATH .. ULANGUAGE .. "&sensor=false" elseif MODE == "gsv" then - ULOCATION = "location=" .. url.escape(LOCATION) - USIZE = "&size=" .. url.escape(SIZE) - UHEADING = "&heading=" .. url.escape(HEADING) - UFOV = "&fov=" .. url.escape(FOV) - UPITCH = "&pitch=" .. url.escape(PITCH) + ULOCATION = "location=" .. url_escape(LOCATION) + USIZE = "&size=" .. url_escape(SIZE) + UHEADING = "&heading=" .. url_escape(HEADING) + UFOV = "&fov=" .. url_escape(FOV) + UPITCH = "&pitch=" .. url_escape(PITCH) UOFILE = OFILE .. ".jpg" IMGURL = GSVURL .. "?" .. ULOCATION .. USIZE .. UHEADING .. UFOV .. UPITCH .. "&sensor=false" elseif MODE == "osm" then - UKEY = "?key=" .. url.escape(KEY) - ULOCATION = "&location=" .. url.escape(LOCATION) - USIZE = "&size=" .. url.escape(SIZE) + UKEY = "?key=" .. url_escape(KEY) + ULOCATION = "&location=" .. url_escape(LOCATION) + USIZE = "&size=" .. url_escape(SIZE) if ZOOM == "" then - USCALEZOOM = "&scale=" .. url.escape(SCALE) + USCALEZOOM = "&scale=" .. url_escape(SCALE) else - USCALEZOOM = "&zoom=" .. url.escape(ZOOM) + USCALEZOOM = "&zoom=" .. url_escape(ZOOM) end - UTYPE = "&type=" .. url.escape(TYPE) - UIMAGETYPE = "&imagetype=" .. url.escape(IMAGETYPE) - USHOWICON = "&showicon=" .. url.escape(COLOR) .. "-" .. url.escape(NUMBER) + UTYPE = "&type=" .. url_escape(TYPE) + UIMAGETYPE = "&imagetype=" .. url_escape(IMAGETYPE) + USHOWICON = "&showicon=" .. url_escape(COLOR) .. "-" .. url_escape(NUMBER) UOFILE = OFILE .. "." .. IMAGETYPE IMGURL = OSMURL .. UKEY .. ULOCATION .. USIZE .. USCALEZOOM .. UTYPE .. UIMAGETYPE .. USHOWICON end diff --git a/Master/texmf-dist/doc/latex/getmap/README.md b/Master/texmf-dist/doc/latex/getmap/README.md index 8ba3ed5727e..fab8b627890 100644 --- a/Master/texmf-dist/doc/latex/getmap/README.md +++ b/Master/texmf-dist/doc/latex/getmap/README.md @@ -10,10 +10,9 @@ can use this script also from the command line. License: LPPL -Changes in v1.9: +Changes in v1.10: -* compatibility fix for luatex v0.85+ +* Workaround for module (socket.url) loading bug in luatex v1.0.7 -* Bugfix: restore some option defaults to guarantee correct - download URLs after changing mode in \getmap +* Bugfix: fix for strange encoding problems when calling getmapdl.lua diff --git a/Master/texmf-dist/doc/latex/getmap/getmap-example.tex b/Master/texmf-dist/doc/latex/getmap/getmap-example.tex index 1419a15fc81..d40db09ef6e 100644 --- a/Master/texmf-dist/doc/latex/getmap/getmap-example.tex +++ b/Master/texmf-dist/doc/latex/getmap/getmap-example.tex @@ -6,7 +6,7 @@ %% %% getmap.dtx (with options: `examplefile') %% -%% Copyright (C) 2014,2016 by: +%% Copyright (C) 2014,2016,2018 by: %% Josef Kleber %% %% @@ -32,7 +32,6 @@ %% %% \documentclass{article} -\usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{filecontents} %% use overwrite while optimizing the image diff --git a/Master/texmf-dist/doc/latex/getmap/getmap.dtx b/Master/texmf-dist/doc/latex/getmap/getmap.dtx index 8db5dfd7feb..8ec1d4b8dcb 100644 --- a/Master/texmf-dist/doc/latex/getmap/getmap.dtx +++ b/Master/texmf-dist/doc/latex/getmap/getmap.dtx @@ -16,12 +16,11 @@ can use this script also from the command line. License: LPPL -Changes in v1.9: +Changes in v1.10: -* compatibility fix for luatex v0.85+ +* Workaround for module (socket.url) loading bug in luatex v1.0.7 -* Bugfix: restore some option defaults to guarantee correct - download URLs after changing mode in \getmap +* Bugfix: fix for strange encoding problems when calling getmapdl.lua % %<*bibfile> @@ -121,15 +120,22 @@ Changes in v1.9: -- -- getmapdl [options] -- --- downloads an OpenStreetMap, Google Maps or Google Street View map --- specified by [options] or parses gpx, gps and kml files to create +-- downloads an OpenStreetMap, Google Maps or Google Street View map +-- specified by [options] or parses gpx, gps and kml files to create -- encoded polylines -- -- License: LPPL -- -local http = require("socket.http"); +local http = require("socket.http") local ltn12 = require("ltn12") -local url = require("socket.url") +-- local url = require("socket.url") +-- avoid bug in luatex v1.0.7 +-- copied socket.url's escape function into local function url_escape +function url_escape(s) + return (string.gsub(s, "([^A-Za-z0-9_])", function(c) + return string.format("%%%02x", string.byte(c)) + end)) +end local OSMURL = "http://open.mapquestapi.com/staticmap/v4/getplacemap" local GMURL = "http://maps.googleapis.com/maps/api/staticmap" @@ -160,7 +166,7 @@ local KMLFILE = "" local BOUND = 0.1 local OFILE = "getmap" local QUIET = "false" -local VERSION = "v1.5 (07/10/2014)" +local VERSION = "v1.5a (2018/07/18)" function pversion() print("getmapdl.lua " .. VERSION) @@ -173,13 +179,13 @@ function phelp() getmapdl.lua [options] downloads an OpenStreetMap, Google Maps or Google Street View map - specified by [options] or parses gpx, gps and kml files to create + specified by [options] or parses gpx, gps and kml files to create encoded polylines Options: -m specify the mode (osm|gm|gsv|gpx2epl|gps2epl|gpx2gps|kml2epl|kml2gps) - + -l specify a location e.g. 'Bergheimer Straße 110A, 69115 Heidelberg, Germany' @@ -215,9 +221,9 @@ getmapdl.lua [options] -h prints help information gm mode only: - + -L specify the language of map labels (xx language code (en,de,fr,...)) - + -M specify markers; see: https://developers.google.com/maps/documentation/staticmaps/index#Markers e.g.: &markers=size:mid|color:blue|label:1|address or more of these @@ -229,31 +235,31 @@ getmapdl.lua [options] -P specify path from location to location e.g.: &path=weight:7|color:purple|loc1|loc2 - + -p specify a file holding the path specification (maybe needed for encoded polylines) gsv mode only: - + -H specify heading (view) (0) (0 -- 360) (east: 90, ...) - + -T specify the pitch (angle) (0) (-90 -- 90) - + -F specify horizontal field of view (90) (0 -- 120) The field of view is expressed in degrees and a kind of zoom! - + gpx2epl, gps2epl and gpx2gps mode only: - + -G specify the gpx or gps file - + kml2epl and kml2gps mode only: - + -K specify the kml file - + gps2gps mode only: - + -B specify the bound for reducing way points (default: 0.1) - + ]]) pversion() end @@ -430,13 +436,13 @@ if MODE == "gpx2epl" then local Olatitude = 0 local Olongitude = 0 local epl = {} - + for line in io.lines(file) do local latitude local longitude local encnum - + if string.match(line, "") then Olatitude = 0 Olongitude = 0 @@ -483,13 +489,13 @@ if MODE == "gpx2gps" then local file = GPFILE local name local desc - + for line in io.lines(file) do local latitude local longitude local encnum - + if string.match(line, "") then name = "" desc = "" @@ -545,7 +551,7 @@ if MODE == "gps2gps" then line = "" ignorenextline = false end - -- if line contains "Point:" then gps coordinates + -- if line contains "Point:" then gps coordinates -- in the next line must be ignored! if line:match("Point:") then ignorenextline = true @@ -566,7 +572,7 @@ if MODE == "gps2gps" then print("\n" .. line .. "\n") line = "" end - if line == "" or isnotnumber(latitude) or isnotnumber(longitude) + if line == "" or isnotnumber(latitude) or isnotnumber(longitude) then -- empty line or no gps coordinates -> do nothing else @@ -609,7 +615,7 @@ if MODE == "gps2epl" then local latitude local longitude local encnum - + latitude, longitude = line:match("([^,]+),([^,]+)") if ignorenextline == true then line = "" @@ -884,37 +890,37 @@ local UOFILE = "" local IMGURL = "" if MODE == "gm" then - ULOCATION = "center=" .. url.escape(LOCATION) + ULOCATION = "center=" .. url_escape(LOCATION) if MARKERS == "" then - UMARKERS = "&markers=size:mid|color:" .. COLOR .. "|label:" .. NUMBER .. "|" .. url.escape(LOCATION) - UZOOM = "&zoom=" .. url.escape(ZOOM) + UMARKERS = "&markers=size:mid|color:" .. COLOR .. "|label:" .. NUMBER .. "|" .. url_escape(LOCATION) + UZOOM = "&zoom=" .. url_escape(ZOOM) else - UMARKERS = "" .. url.escape(MARKERS) + UMARKERS = "" .. url_escape(MARKERS) -- correct cruft escaping of "&markers=" UMARKERS = UMARKERS:gsub("%%26markers%%3d","&markers=") UZOMM = "" if CENTER == "" then ULOCATION = "" else - ULOCATION = "center=" .. url.escape(CENTER) + ULOCATION = "center=" .. url_escape(CENTER) end end - USIZE = "&size=" .. url.escape(SIZE) - USCALE = "&scale=" .. url.escape(SCALE) - UTYPE = "&maptype=" .. url.escape(TYPE) - UIMAGETYPE = "&format=" .. url.escape(IMAGETYPE) + USIZE = "&size=" .. url_escape(SIZE) + USCALE = "&scale=" .. url_escape(SCALE) + UTYPE = "&maptype=" .. url_escape(TYPE) + UIMAGETYPE = "&format=" .. url_escape(IMAGETYPE) if IMAGETYPE == "jpg-baseline" then IMAGETYPE = "jpg" end if VISIBLE == "" then UVISIBLE = "" else - UVISIBLE = "&visible=" .. url.escape(VISIBLE) + UVISIBLE = "&visible=" .. url_escape(VISIBLE) end if IPATH == "" then UIPATH = "" else - UIPATH = "" .. url.escape(IPATH) + UIPATH = "" .. url_escape(IPATH) -- correct cruft escaping of "&path=" UIPATH = UIPATH:gsub("%%26path%%3d","&path=") end @@ -924,7 +930,7 @@ if MODE == "gm" then EPLFILE = io.open(FPATH, "r") local contents = EPLFILE:read() EPLFILE:close() - UFPATH = "" .. url.escape(contents) + UFPATH = "" .. url_escape(contents) -- correct cruft escaping of "&path=" UFPATH = UFPATH:gsub("%%26path%%3d","&path=") end @@ -936,25 +942,25 @@ if MODE == "gm" then UOFILE = OFILE .. "." .. IMAGETYPE IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. UFPATH .. ULANGUAGE .. "&sensor=false" elseif MODE == "gsv" then - ULOCATION = "location=" .. url.escape(LOCATION) - USIZE = "&size=" .. url.escape(SIZE) - UHEADING = "&heading=" .. url.escape(HEADING) - UFOV = "&fov=" .. url.escape(FOV) - UPITCH = "&pitch=" .. url.escape(PITCH) + ULOCATION = "location=" .. url_escape(LOCATION) + USIZE = "&size=" .. url_escape(SIZE) + UHEADING = "&heading=" .. url_escape(HEADING) + UFOV = "&fov=" .. url_escape(FOV) + UPITCH = "&pitch=" .. url_escape(PITCH) UOFILE = OFILE .. ".jpg" IMGURL = GSVURL .. "?" .. ULOCATION .. USIZE .. UHEADING .. UFOV .. UPITCH .. "&sensor=false" elseif MODE == "osm" then - UKEY = "?key=" .. url.escape(KEY) - ULOCATION = "&location=" .. url.escape(LOCATION) - USIZE = "&size=" .. url.escape(SIZE) + UKEY = "?key=" .. url_escape(KEY) + ULOCATION = "&location=" .. url_escape(LOCATION) + USIZE = "&size=" .. url_escape(SIZE) if ZOOM == "" then - USCALEZOOM = "&scale=" .. url.escape(SCALE) + USCALEZOOM = "&scale=" .. url_escape(SCALE) else - USCALEZOOM = "&zoom=" .. url.escape(ZOOM) + USCALEZOOM = "&zoom=" .. url_escape(ZOOM) end - UTYPE = "&type=" .. url.escape(TYPE) - UIMAGETYPE = "&imagetype=" .. url.escape(IMAGETYPE) - USHOWICON = "&showicon=" .. url.escape(COLOR) .. "-" .. url.escape(NUMBER) + UTYPE = "&type=" .. url_escape(TYPE) + UIMAGETYPE = "&imagetype=" .. url_escape(IMAGETYPE) + USHOWICON = "&showicon=" .. url_escape(COLOR) .. "-" .. url_escape(NUMBER) UOFILE = OFILE .. "." .. IMAGETYPE IMGURL = OSMURL .. UKEY .. ULOCATION .. USIZE .. USCALEZOOM .. UTYPE .. UIMAGETYPE .. USHOWICON end @@ -1002,7 +1008,6 @@ os.exit(0) %% % \fi \documentclass{article} -\usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{filecontents} % \iffalse @@ -1051,7 +1056,7 @@ manifest.txt \askforoverwritefalse \preamble -Copyright (C) 2014,2016 by: +Copyright (C) 2014,2016,2018 by: Josef Kleber @@ -1133,7 +1138,7 @@ This work consists of all files listed in manifest.txt. \usepackage[automark,nouppercase]{scrpage2} \usepackage[tocgraduated]{tocstyle} \usetocstyle{classic} -\usepackage[overwrite=false]{getmap} +\usepackage[overwrite=true]{getmap} \usepackage{attachfile} \usepackage{metalogo} \usepackage{tikz} @@ -1184,7 +1189,7 @@ emph={}} \draw[anchor=west,yshift=-9cm,xshift=3cm,color=NavyBlue] (0,0) node% {\parbox{15cm}{\RaggedRight\huge\sffamily\textbf{\@subtitle}}};% \draw[anchor=west,yshift=-14cm,xshift=3cm,color=NavyBlue] (0,0) node% - {\includegraphics[width=8cm]{getmap}};% + {\includegraphics[width=8cm]{getmap.png}};% \draw[anchor=west,yshift=-18cm,xshift=3cm,color=NavyBlue] (0,0) node% {\parbox{15cm}{\huge\sffamily\textbf{\@date}}};% \draw[anchor=west,yshift=-20cm,xshift=3cm,color=NavyBlue] (0,0) node% @@ -1360,7 +1365,7 @@ emph={}} % \renewcommand*{\abstractname}{Acknowledgment} % \begin{abstract} % I want to thank Norbert Preining, who did most of the recoding of \texttt{osmimage} -% (\texttt{Bash} $\rightarrow$ \texttt{Lua}). Moreover many thanks to Taco Hoekwater, +% (\texttt{Bash} $\rightarrow$ \texttt{Lua}). Moreover many thanks to Taco Hoekwater, Akira Kakuto, % Reinhard Kotucha and Heiko Oberdiek for their valuable contributions. % Finally, I want to thank Doug Currie for helping me to implement the algorithm % for encoded polylines in Lua. @@ -1610,7 +1615,7 @@ path={&path=weight:5|color:orange|52.521847,13.394398|% % By default, the image is saved under the name \texttt{getmap.png}! % If you need only one map (e.g. the office of Dante e.V.) in your document, it can be as simple as: % -% \begin{center}\includegraphics[width=9cm]{getmap}\end{center} +% \begin{center}\includegraphics[width=9cm]{getmap.png}\end{center} % % \iffalse %<*example> @@ -1780,7 +1785,7 @@ _p~iF~ps|U_ulLnnqClqNvxq`@ % no way to support extreme long paths! % \subsection{OpenStreetMap} % OpenStreetMap does not offer routing service directly, but you can -% use an OpenStreetMap based route service\footnote{\href{http://openrouteservice.org}{http://openrouteservice.org}} +% use an OpenStreetMap based route service\footnote{\href{http://maps.openrouteservice.org}{http://maps.openrouteservice.org}} % to create your route and export it to a \texttt{gpx} file\footnote{This also means that you can visualize your own routes tracked with hardware or a software app!}. % It's basically a xml-packaged list of geographical coordinates. % You can use the \texttt{getmapdl} script to convert a route to encoded polylines, e.g. @@ -2084,13 +2089,14 @@ output = mucber.png % \changes{v1.8}{2014/10/07}{\texttt{getmapdl.lua}: added \texttt{gps2gps} mode to reduce way points with a given bound (default: 0.1)} % \changes{v1.8}{2014/10/07}{\texttt{getmapdl.lua}: added multi route support for \texttt{gps2epl} mode} % \changes{v1.8}{2014/10/07}{\texttt{getmapdl.lua}: added rounding of gps coordinates to \texttt{kml2gps} and \texttt{gpx2gps} modes} +% \changes{v1.10}{2018/07/18}{\texttt{getmapdl.lua}: fix problem (unable to load socket.url module) caused by bug in luatex v1.0.7 (TeXLive2018)} % \begin{macrocode} %<*package> % \end{macrocode} % First, we provide the \LaTeX\ package \package{getmap}. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{getmap}[2016/06/18 v1.9 getmap.sty - Josef Kleber (C) 2014,2016]% +\ProvidesPackage{getmap}[2018/07/18 v1.10 getmap.sty - Josef Kleber (C) 2014,2016,2018]% % \end{macrocode} % We need a few packages! % \begin{macrocode} @@ -2102,6 +2108,23 @@ output = mucber.png % \begin{macrocode} \RequirePackage{shellesc}% % \end{macrocode} +% Fix a bug with problematic url encodings coming up with \texttt{luatex} v1.0.7 (TeXLive 2018) +% fixed by Akira Kakuto (see: \href{https://tug.org/pipermail/tex-live/2018-June/041997.html}{TeXLive mailing list}) +% \begin{macrocode} +\RequirePackage{ifxetex}% +\ifxetex% + \def\StringEncodingConvert#1#2#3#4% + {% + \def#1{#2}% + }% +\fi% +\ifluatex% + \def\StringEncodingConvert#1#2#3#4% + {% + \def#1{#2}% + }% +\fi% +% \end{macrocode} % We provide a macro \cmd\GM@JK@define@key, which defines package options with global scope% % and options for \cmd\getmap\ with local scope. It takes four arguments \marg{prefix},% % \marg{package},\marg{option} and \marg{default}. @@ -2241,12 +2264,14 @@ output = mucber.png % \cmd\write18\ is enabled and issue a package error if not! Otherwise we execute% % \cmd\ShellEscape\ depending on the mode% % \changes{v1.9}{2016/06/16}{\LuaTeX\ v0.85+ fix: use \texttt{shellesc}'s \texttt{\textbackslash ShellEscape} instead of \texttt{\textbackslash write18}} +% \changes{v1.10}{2018/07/18}{Bugfix: fixes encoding problems with luatex v1.0.7 (TeXLive2018)} % \begin{macrocode} \newcommand*\GM@JK@shellescape% {% \ifGM@JK@writexviii\relax% \ifthenelse{\equal{\GM@JK@mode}{osm}}% {% + \ifluatex\directlua{os.setlocale('','ctype')}\fi% \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"% \space-m\space osm% \space-k\space "\GM@JK@key@string"% @@ -2263,6 +2288,7 @@ output = mucber.png {% \ifthenelse{\equal{\GM@JK@mode}{gm}}% {% + \ifluatex\directlua{os.setlocale('','ctype')}\fi% \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"% \space-m\space gm% \space-x\space \GM@JK@xsize% @@ -2284,6 +2310,7 @@ output = mucber.png {% \ifthenelse{\equal{\GM@JK@mode}{gsv}}% {% + \ifluatex\directlua{os.setlocale('','ctype')}\fi% \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"% \space-m\space gsv% \space-x\space \GM@JK@xsize% diff --git a/Master/texmf-dist/doc/latex/getmap/getmap.pdf b/Master/texmf-dist/doc/latex/getmap/getmap.pdf index b6c11d0c28f..b9436477bae 100644 Binary files a/Master/texmf-dist/doc/latex/getmap/getmap.pdf and b/Master/texmf-dist/doc/latex/getmap/getmap.pdf differ diff --git a/Master/texmf-dist/doc/latex/getmap/makefile b/Master/texmf-dist/doc/latex/getmap/makefile index 2509fefc5d3..dffa6411ac2 100644 --- a/Master/texmf-dist/doc/latex/getmap/makefile +++ b/Master/texmf-dist/doc/latex/getmap/makefile @@ -12,14 +12,14 @@ $(PKGNAME).pdf: bibtex $(PKGNAME) makeindex -s gind.ist $(PKGNAME) makeindex -s gglo.ist $(PKGNAME).glo -o $(PKGNAME).gls - pdflatex $(PKGNAME).dtx + pdflatex -shell-escape $(PKGNAME).dtx bibtex $(PKGNAME) makeindex -s gind.ist $(PKGNAME) makeindex -s gglo.ist $(PKGNAME).glo -o $(PKGNAME).gls - pdflatex $(PKGNAME).dtx + pdflatex -shell-escape $(PKGNAME).dtx makeindex -s gind.ist $(PKGNAME) makeindex -s gglo.ist $(PKGNAME).glo -o $(PKGNAME).gls - pdflatex $(PKGNAME).dtx + pdflatex -shell-escape $(PKGNAME).dtx package: pdftex $(PKGNAME).dtx @@ -57,7 +57,7 @@ git: package cp getmap.cfg ./../dev/tex/latex/getmap/getmap.cfg cp README.md ./../README.md -ctan: +ctan: $(PKGNAME).pdf ./copyCTAN clean: @@ -67,6 +67,6 @@ clean: cleanall: clean $(RM) getmapdl.lua *.sty *.png *.jpg manifest.txt \ - *.cfg *.tex README.md getmap.pdf + *.cfg *.tex README.md *.pdf .PHONY: all doc package install uninstall styles git ctan clean cleanall diff --git a/Master/texmf-dist/scripts/getmap/getmapdl.lua b/Master/texmf-dist/scripts/getmap/getmapdl.lua index 841574e91d7..f0f366cc433 100755 --- a/Master/texmf-dist/scripts/getmap/getmapdl.lua +++ b/Master/texmf-dist/scripts/getmap/getmapdl.lua @@ -8,9 +8,16 @@ -- -- License: LPPL -- -local http = require("socket.http"); +local http = require("socket.http") local ltn12 = require("ltn12") -local url = require("socket.url") +-- local url = require("socket.url") +-- avoid bug in luatex v1.0.7 +-- copied socket.url's escape function into local function url_escape +function url_escape(s) + return (string.gsub(s, "([^A-Za-z0-9_])", function(c) + return string.format("%%%02x", string.byte(c)) + end)) +end local OSMURL = "http://open.mapquestapi.com/staticmap/v4/getplacemap" local GMURL = "http://maps.googleapis.com/maps/api/staticmap" @@ -41,7 +48,7 @@ local KMLFILE = "" local BOUND = 0.1 local OFILE = "getmap" local QUIET = "false" -local VERSION = "v1.5 (07/10/2014)" +local VERSION = "v1.5a (2018/07/18)" function pversion() print("getmapdl.lua " .. VERSION) @@ -765,37 +772,37 @@ local UOFILE = "" local IMGURL = "" if MODE == "gm" then - ULOCATION = "center=" .. url.escape(LOCATION) + ULOCATION = "center=" .. url_escape(LOCATION) if MARKERS == "" then - UMARKERS = "&markers=size:mid|color:" .. COLOR .. "|label:" .. NUMBER .. "|" .. url.escape(LOCATION) - UZOOM = "&zoom=" .. url.escape(ZOOM) + UMARKERS = "&markers=size:mid|color:" .. COLOR .. "|label:" .. NUMBER .. "|" .. url_escape(LOCATION) + UZOOM = "&zoom=" .. url_escape(ZOOM) else - UMARKERS = "" .. url.escape(MARKERS) + UMARKERS = "" .. url_escape(MARKERS) -- correct cruft escaping of "&markers=" UMARKERS = UMARKERS:gsub("%%26markers%%3d","&markers=") UZOMM = "" if CENTER == "" then ULOCATION = "" else - ULOCATION = "center=" .. url.escape(CENTER) + ULOCATION = "center=" .. url_escape(CENTER) end end - USIZE = "&size=" .. url.escape(SIZE) - USCALE = "&scale=" .. url.escape(SCALE) - UTYPE = "&maptype=" .. url.escape(TYPE) - UIMAGETYPE = "&format=" .. url.escape(IMAGETYPE) + USIZE = "&size=" .. url_escape(SIZE) + USCALE = "&scale=" .. url_escape(SCALE) + UTYPE = "&maptype=" .. url_escape(TYPE) + UIMAGETYPE = "&format=" .. url_escape(IMAGETYPE) if IMAGETYPE == "jpg-baseline" then IMAGETYPE = "jpg" end if VISIBLE == "" then UVISIBLE = "" else - UVISIBLE = "&visible=" .. url.escape(VISIBLE) + UVISIBLE = "&visible=" .. url_escape(VISIBLE) end if IPATH == "" then UIPATH = "" else - UIPATH = "" .. url.escape(IPATH) + UIPATH = "" .. url_escape(IPATH) -- correct cruft escaping of "&path=" UIPATH = UIPATH:gsub("%%26path%%3d","&path=") end @@ -805,7 +812,7 @@ if MODE == "gm" then EPLFILE = io.open(FPATH, "r") local contents = EPLFILE:read() EPLFILE:close() - UFPATH = "" .. url.escape(contents) + UFPATH = "" .. url_escape(contents) -- correct cruft escaping of "&path=" UFPATH = UFPATH:gsub("%%26path%%3d","&path=") end @@ -817,25 +824,25 @@ if MODE == "gm" then UOFILE = OFILE .. "." .. IMAGETYPE IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. UFPATH .. ULANGUAGE .. "&sensor=false" elseif MODE == "gsv" then - ULOCATION = "location=" .. url.escape(LOCATION) - USIZE = "&size=" .. url.escape(SIZE) - UHEADING = "&heading=" .. url.escape(HEADING) - UFOV = "&fov=" .. url.escape(FOV) - UPITCH = "&pitch=" .. url.escape(PITCH) + ULOCATION = "location=" .. url_escape(LOCATION) + USIZE = "&size=" .. url_escape(SIZE) + UHEADING = "&heading=" .. url_escape(HEADING) + UFOV = "&fov=" .. url_escape(FOV) + UPITCH = "&pitch=" .. url_escape(PITCH) UOFILE = OFILE .. ".jpg" IMGURL = GSVURL .. "?" .. ULOCATION .. USIZE .. UHEADING .. UFOV .. UPITCH .. "&sensor=false" elseif MODE == "osm" then - UKEY = "?key=" .. url.escape(KEY) - ULOCATION = "&location=" .. url.escape(LOCATION) - USIZE = "&size=" .. url.escape(SIZE) + UKEY = "?key=" .. url_escape(KEY) + ULOCATION = "&location=" .. url_escape(LOCATION) + USIZE = "&size=" .. url_escape(SIZE) if ZOOM == "" then - USCALEZOOM = "&scale=" .. url.escape(SCALE) + USCALEZOOM = "&scale=" .. url_escape(SCALE) else - USCALEZOOM = "&zoom=" .. url.escape(ZOOM) + USCALEZOOM = "&zoom=" .. url_escape(ZOOM) end - UTYPE = "&type=" .. url.escape(TYPE) - UIMAGETYPE = "&imagetype=" .. url.escape(IMAGETYPE) - USHOWICON = "&showicon=" .. url.escape(COLOR) .. "-" .. url.escape(NUMBER) + UTYPE = "&type=" .. url_escape(TYPE) + UIMAGETYPE = "&imagetype=" .. url_escape(IMAGETYPE) + USHOWICON = "&showicon=" .. url_escape(COLOR) .. "-" .. url_escape(NUMBER) UOFILE = OFILE .. "." .. IMAGETYPE IMGURL = OSMURL .. UKEY .. ULOCATION .. USIZE .. USCALEZOOM .. UTYPE .. UIMAGETYPE .. USHOWICON end diff --git a/Master/texmf-dist/tex/latex/getmap/getmap.cfg b/Master/texmf-dist/tex/latex/getmap/getmap.cfg index 305b7ad96b4..ba7e250979b 100644 --- a/Master/texmf-dist/tex/latex/getmap/getmap.cfg +++ b/Master/texmf-dist/tex/latex/getmap/getmap.cfg @@ -6,7 +6,7 @@ %% %% getmap.dtx (with options: `cfgfile') %% -%% Copyright (C) 2014,2016 by: +%% Copyright (C) 2014,2016,2018 by: %% Josef Kleber %% %% diff --git a/Master/texmf-dist/tex/latex/getmap/getmap.sty b/Master/texmf-dist/tex/latex/getmap/getmap.sty index 5931dfc3a17..79831f5c171 100644 --- a/Master/texmf-dist/tex/latex/getmap/getmap.sty +++ b/Master/texmf-dist/tex/latex/getmap/getmap.sty @@ -6,7 +6,7 @@ %% %% getmap.dtx (with options: `package') %% -%% Copyright (C) 2014,2016 by: +%% Copyright (C) 2014,2016,2018 by: %% Josef Kleber %% %% @@ -27,11 +27,24 @@ %% This work consists of all files listed in manifest.txt. %% \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{getmap}[2016/06/18 v1.9 getmap.sty - Josef Kleber (C) 2014,2016]% +\ProvidesPackage{getmap}[2018/07/18 v1.10 getmap.sty - Josef Kleber (C) 2014,2016,2018]% \RequirePackage{xkeyval}% \RequirePackage{stringenc}% \RequirePackage{ifthen}% \RequirePackage{shellesc}% +\RequirePackage{ifxetex}% +\ifxetex% + \def\StringEncodingConvert#1#2#3#4% + {% + \def#1{#2}% + }% +\fi% +\ifluatex% + \def\StringEncodingConvert#1#2#3#4% + {% + \def#1{#2}% + }% +\fi% \newcommand*\GM@JK@define@key[4]% {% \expandafter\gdef\csname#1@#3\endcsname{#4}% @@ -124,6 +137,7 @@ \ifGM@JK@writexviii\relax% \ifthenelse{\equal{\GM@JK@mode}{osm}}% {% + \ifluatex\directlua{os.setlocale('','ctype')}\fi% \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"% \space-m\space osm% \space-k\space "\GM@JK@key@string"% @@ -140,6 +154,7 @@ {% \ifthenelse{\equal{\GM@JK@mode}{gm}}% {% + \ifluatex\directlua{os.setlocale('','ctype')}\fi% \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"% \space-m\space gm% \space-x\space \GM@JK@xsize% @@ -161,6 +176,7 @@ {% \ifthenelse{\equal{\GM@JK@mode}{gsv}}% {% + \ifluatex\directlua{os.setlocale('','ctype')}\fi% \ShellEscape{getmapdl \space-l\space "\GM@JK@location@string"% \space-m\space gsv% \space-x\space \GM@JK@xsize% -- cgit v1.2.3