[latex3-commits] [git/LaTeX3-latex3-luaotfload] asciiquotes-dev: Switch from "%s" to %q (29a1152)

Marcel Fabian Krüger tex at 2krueger.de
Tue Feb 11 17:17:53 CET 2020


Repository : https://github.com/latex3/luaotfload
On branch  : asciiquotes-dev
Link       : https://github.com/latex3/luaotfload/commit/29a115221ca8c99d6a3cfb7cd7de5d44f9fd66c2

>---------------------------------------------------------------

commit 29a115221ca8c99d6a3cfb7cd7de5d44f9fd66c2
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Tue Feb 11 17:17:53 2020 +0100

    Switch from "%s" to %q


>---------------------------------------------------------------

29a115221ca8c99d6a3cfb7cd7de5d44f9fd66c2
 src/luaotfload-configuration.lua | 18 +++++++++---------
 src/luaotfload-database.lua      |  6 +++---
 src/luaotfload-init.lua          | 16 ++++++++--------
 src/luaotfload-loaders.lua       | 12 ++++++------
 src/luaotfload-main.lua          | 22 +++++++++++-----------
 src/luaotfload-resolvers.lua     |  6 +++---
 6 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua
index 8383016..bf6a11c 100644
--- a/src/luaotfload-configuration.lua
+++ b/src/luaotfload-configuration.lua
@@ -151,7 +151,7 @@ local registered_loaders = {
 local pick_fontloader = function (s)
   local ldr = registered_loaders[s]
   if ldr ~= nil and type (ldr) == "string" then
-    logreport ("log", 2, "conf", "Using predefined fontloader \"%s\".", ldr)
+    logreport ("log", 2, "conf", "Using predefined fontloader %q.", ldr)
     return ldr
   end
   local idx = stringfind (s, ":")
@@ -159,17 +159,17 @@ local pick_fontloader = function (s)
     if stringsub (s, 1, idx - 1) == "context" then
       local pth = stringsub (s, idx + 1)
       pth = stringstrip (pth)
-      logreport ("log", 2, "conf", "Context base path specified at \"%s\".", pth)
+      logreport ("log", 2, "conf", "Context base path specified at %q.", pth)
       if lfsisdir (pth) then
-        logreport ("log", 5, "conf", "Context base path exists at \"%s\".", pth)
+        logreport ("log", 5, "conf", "Context base path exists at %q.", pth)
         return pth
       end
       pth = kpseexpand_path (pth)
       if lfsisdir (pth) then
-        logreport ("log", 5, "conf", "Context base path exists at \"%s\".", pth)
+        logreport ("log", 5, "conf", "Context base path exists at %q.", pth)
         return pth
       end
-      logreport ("both", 0, "conf", "Context base path not found at \"%s\".", pth)
+      logreport ("both", 0, "conf", "Context base path not found at %q.", pth)
     end
   end
   return nil
@@ -362,7 +362,7 @@ local build_cache_paths = function ()
   end
 
   prefix = lpegmatch (stripslashes, prefix)
-  logreport ("log", 0, "conf", "Root cache directory is %s.", prefix)
+  logreport ("log", 0, "conf", "Root cache directory is %q.", prefix)
 
   local index_file      = filejoin (prefix, paths.index_file)
   local lookups_file    = filejoin (prefix, paths.lookups_file)
@@ -571,7 +571,7 @@ local option_spec = {
           return ldr
         end
         logreport ("log", 0, "conf",
-                    "Requested fontloader \"%s\" not defined, "
+                    "Requested fontloader %q not defined, "
                     .. "use at your own risk.",
                     id)
         return id
@@ -590,12 +590,12 @@ local option_spec = {
         local cb = permissible_color_callbacks[cb_spec]
         if cb then
           logreport ("log", 3, "conf",
-                     "Using callback \"%s\" for font colorization.",
+                     "Using callback %q for font colorization.",
                      cb)
           return cb
         end
         logreport ("log", 0, "conf",
-                    "Requested callback identifier \"%s\" invalid, "
+                    "Requested callback identifier %q invalid, "
                     .. "falling back to default.",
                     cb_spec)
         return permissible_color_callbacks.default
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index d758798..c401ef9 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -1413,7 +1413,7 @@ find_closest = function (name, limit)
             local dist     = distances[i]
             local namelst  = delete_dupes (by_distance[dist])
             logreport (false, 0, "query",
-                       "Distance from \"%s\": %s\n    "
+                       "Distance from %q: %s\n    "
                        .. tableconcat (namelst, "\n    "),
                        name, dist)
         end
@@ -2344,7 +2344,7 @@ local filter_out_pwd = function (dirs)
         local dir = path_normalize (lpegmatch (stripslashes, dirs[i]))
         if dir == "." or dir == pwd then
             logreport ("both", 3, "db",
-                       "Path \"%s\" matches $PWD (\"%s\"), skipping.",
+                       "Path %q matches $PWD (%q), skipping.",
                        dir, pwd)
         else
             result[#result+1] = dir
@@ -2452,7 +2452,7 @@ local count_removed = function (files)
         local f = old[i]
         if not kpsereadable_file (f) then
             logreport ("log", 2, "db",
-                      "File %s does not exist in file system.")
+                      "File %q does not exist in file system.")
             nrem = nrem + 1
         end
     end
diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua
index 139f8c7..2f5bc9b 100644
--- a/src/luaotfload-init.lua
+++ b/src/luaotfload-init.lua
@@ -392,36 +392,36 @@ local function init_main(early_hook)
 
   elseif lfsisdir (fontloader) and verify_context_dir (fontloader) then
     logreport ("log", 0, "init",
-               "Loading Context files under prefix \"%s\".",
+               "Loading Context files under prefix %q.",
                fontloader)
     load_context_modules (fontloader)
 
   elseif lfs.isfile (fontloader) then
     logreport ("log", 0, "init",
-               "Loading fontloader from absolute path \"%s\".",
+               "Loading fontloader from absolute path %q.",
                fontloader)
     local _void = assert (loadfile (fontloader, nil, context_environment)) ()
 
   elseif kpsefind_file (fontloader) then
     local path = kpsefind_file (fontloader)
     logreport ("log", 0, "init",
-               "Loading fontloader \"%s\" from kpse-resolved path \"%s\".",
+               "Loading fontloader %q from kpse-resolved path %q.",
                fontloader, path)
     local _void = assert (loadfile (path, nil, context_environment)) ()
 
   elseif kpsefind_file (("fontloader-%s.lua"):format(fontloader)) then
     logreport ("log", 0, "init",
-               "Using predefined fontloader \"%s\".",
+               "Using predefined fontloader %q.",
                fontloader)
     load_fontloader_module (fontloader)
 
   else
     logreport ("both", 0, "init",
-               "No match for requested fontloader \"%s\".",
+               "No match for requested fontloader %q.",
                fontloader)
     fontloader = luaotfload.fontloader_package
     logreport ("both", 0, "init",
-               "Defaulting to predefined fontloader \"%s\".",
+               "Defaulting to predefined fontloader %q.",
                fontloader)
     load_fontloader_module (fontloader)
   end
@@ -429,7 +429,7 @@ local function init_main(early_hook)
   ---load_fontloader_module "font-odv.lua" --- <= Devanagari support from Context
 
   logreport ("log", 0, "init",
-             "Context OpenType loader version \"%s\"",
+             "Context OpenType loader version %q",
              fonts.handlers.otf.version)
   callback.register = trapped_register
   nodes = context_environment.nodes
@@ -532,7 +532,7 @@ local init_post_load_agl = function ()
       return nil
     end
     logreport ("both", 4, "init",
-               "found Adobe glyph list file at ``%s``, using that.",
+               "found Adobe glyph list file at %q, using that.",
                glyphlist)
 
     local unicodes = dofile(glyphlist)
diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua
index 261dbf8..eaefb73 100644
--- a/src/luaotfload-loaders.lua
+++ b/src/luaotfload-loaders.lua
@@ -39,7 +39,7 @@ local eval_reader = function (specification)
   local eval = specification.eval
   if not eval or type (eval) ~= "function" then return nil end
   logreport ("both", 0, "loaders",
-             "eval: found tfmdata for \"%s\", injecting.",
+             "eval: found tfmdata for %q, injecting.",
              specification.name)
   return eval ()
 end
@@ -47,7 +47,7 @@ end
 local unsupported_reader = function (format)
   return function (specification)
     logreport ("both", 4, "loaders",
-               "font format \"%s\" unsupported; cannot load %s.",
+               "font format %q unsupported; cannot load %s.",
                format, tostring (specification.name))
   end
 end
@@ -68,14 +68,14 @@ local install_formats = function ()
   local aux = function (which, reader)
     if   not which  or type (which) ~= "string"
       or not reader or type (reader) ~= "function" then
-      logreport ("both", 2, "loaders", "Error installing reader for \"%s\".", which)
+      logreport ("both", 2, "loaders", "Error installing reader for %q.", which)
       return false
     end
     formats  [which] = "type1"
     readers  [which] = reader
     if not seqset [which] then
       logreport ("both", 3, "loaders",
-                 "Extending reader sequence for \"%s\".", which)
+                 "Extending reader sequence for %q.", which)
       sequence [#sequence + 1] = which
       seqset   [which]         = true
     end
@@ -210,10 +210,10 @@ local purge_define_font = function ()
     if d2 then --> issue warning
       logreport ("both", 0, "loaders",
                  "Callback table for define_font contains multiple entries: \z
-                  { [%d] = \"%s\" } -- seems fishy.", i, d2)
+                  { [%d] = %q } -- seems fishy.", i, d2)
     end
     logreport ("log", 0, "loaders",
-               "Entry ``%s`` present in define_font callback; overriding.", d)
+               "Entry %q present in define_font callback; overriding.", d)
     luatexbase.remove_from_callback ("define_font", d)
   end
 end
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index c2cc769..cbd503a 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -68,7 +68,7 @@ end
 if not utf8 then
     texio.write_nl("term and log", string.format("\z
         \tluaotfload: module utf8 is unavailable\n\z
-        \tutf8 is available in Lua 5.3+; engine\'s _VERSION is '%s'\n\z
+        \tutf8 is available in Lua 5.3+; engine\'s _VERSION is %q\n\z
         \tThis probably means that the engine is not supported\n\z
         \n",
         _VERSION))
@@ -129,14 +129,14 @@ local make_loader_name = function (prefix, name)
              end
     if not name then
         msg ("both", 0, "load",
-             "Fatal error: make_loader_name (\"%s\", \"%s\").",
+             "Fatal error: make_loader_name (%q, %q).",
              tostring (prefix), tostring (name))
         return "dummy-name"
     end
     name = tostring (name)
     if prefix == false then
         msg ("log", 9, "load",
-             "No prefix requested, passing module name \"%s\" unmodified.",
+             "No prefix requested, passing module name %q unmodified.",
              name)
         return tostring (name) .. ".lua"
     end
@@ -196,7 +196,7 @@ end
 
 local dummy_loader = function (name)
     luaotfload.log.report ("log", 3, "load",
-                           "Skipping module \"%s\" on purpose.",
+                           "Skipping module %q on purpose.",
                            name)
 end
 
@@ -205,14 +205,14 @@ luaotfload.fontloader = context_environment
 local function context_isolated_load(name)
     local fullname = kpse.find_file(name, 'lua')
     if not fullname then
-        error(string.format('Fontloader module "%s" could not be found.', name))
+        error(string.format('Fontloader module %q could not be found.', name))
     end
     return assert(loadfile(fullname, nil, context_environment))(name)
 end
 
 local context_loader = function (name, path)
     luaotfload.log.report ("log", 3, "load",
-                           "Loading module \"%s\" from Context.",
+                           "Loading module %q from Context.",
                            name)
     local t_0 = osgettimeofday ()
     local modname = make_loader_name (false, name)
@@ -220,12 +220,12 @@ local context_loader = function (name, path)
     if path then
         if lfs.isdir (path) then
             luaotfload.log.report ("log", 3, "load",
-                                   "Prepending path \"%s\".",
+                                   "Prepending path %q.",
                                    path)
             modpath = file.join (path, modname)
         else
             luaotfload.log.report ("both", 0, "load",
-                                   "Non-existant path \"%s\" specified, ignoring.",
+                                   "Non-existant path %q specified, ignoring.",
                                    path)
         end
     end
@@ -239,7 +239,7 @@ local context_loader = function (name, path)
         --- something isn’t right, but against HH’s coding practices. We’ll
         --- silently ignore this ever happening on lower log levels.
         luaotfload.log.report ("log", 4, "load",
-                               "Module \"%s\" returned \"%s\".", ret)
+                               "Module %q returned %q.", ret)
     end
     return ret
 end
@@ -261,13 +261,13 @@ local install_loaders = function ()
             local t_0 = osgettimeofday ()
             if not init () then
                 logreport ("log", 0, "load",
-                           "Failed to load module \"%s\".", name)
+                           "Failed to load module %q.", name)
                 return
             end
             local t_end = osgettimeofday ()
             local d_t = t_end - t_0
             logreport ("log", 4, "load",
-                       "Module \"%s\" loaded in %d ms.",
+                       "Module %q loaded in %d ms.",
                        name, d_t)
             timing_info.t_init [name] = d_t
         end
diff --git a/src/luaotfload-resolvers.lua b/src/luaotfload-resolvers.lua
index b5e1e76..a4458a2 100644
--- a/src/luaotfload-resolvers.lua
+++ b/src/luaotfload-resolvers.lua
@@ -114,9 +114,9 @@ local function resolve_name (specification)
     end
     local resolved, subfont = resolver (specification)
     if resolved then
-        logreport ("log", 1, "resolve", "name lookup %q -> \"%s%s\"",
-                   specification.name, resolved,
-                   subfont and stringformat ("(%d)", subfont) or "")
+        logreport ("log", 1, "resolve", "name lookup %q -> %q",
+                   specification.name, resolved ..
+                   (subfont and stringformat ("(%d)", subfont) or ""))
         return resolved, tonumber(subfont)
     end
     return resolve_file (specification)





More information about the latex3-commits mailing list.