Skip to content

Commit

Permalink
[fix] \everymplib{%^^M
Browse files Browse the repository at this point in the history
  • Loading branch information
dohyunkim committed Feb 23, 2014
1 parent cc56dff commit 97025d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
History of the luamplib package

2014/02/22 2.5.2
2014/02/24 2.5.2
* new macros \mplibmakenocache{...} and \mplibcancelnocache{...} to
register/unregister those .mp files that do not need caches.
These macros affect the compilation speed only.
Expand Down
27 changes: 15 additions & 12 deletions luamplib.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ See source file '\inFileName' for licencing and contact information.
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{luamplib.drv}%
[2014/02/23 v2.5.2 Interface for using the mplib library]%
[2014/02/24 v2.5.2 Interface for using the mplib library]%
\documentclass{ltxdoc}
\usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
\usepackage[x11names]{xcolor}
Expand Down Expand Up @@ -154,7 +154,7 @@ See source file '\inFileName' for licencing and contact information.
% \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\
% Maintainer: LuaLaTeX Maintainers ---
% Support: \email{[email protected]}}
% \date{2014/02/23 v2.5.2}
% \date{2014/02/24 v2.5.2}
%
% \maketitle
%
Expand Down Expand Up @@ -297,7 +297,7 @@ luamplib.lastlog = ""
local err, warn, info, log = luatexbase.provides_module({
name = "luamplib",
version = "2.5.2",
date = "2014/02/23",
date = "2014/02/24",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
})

Expand Down Expand Up @@ -407,7 +407,9 @@ local function replaceformatmp(file,newfile)
end

local function replaceinputmpfile (name,file)
local newfile = stringgsub(file,".*/","luamplib_input_")
local newfile = stringgsub(name,"%.mp$","")
newfile = stringgsub(newfile,"%W","_")
newfile = "luamplib_input_"..newfile..".mp"
if newfile and luamplibchange then
local ofchange = lfs.attributes(file,"modification")
local nf = lfs.attributes(newfile)
Expand Down Expand Up @@ -854,29 +856,30 @@ extra_endfig := extra_endfig & " let VerbatimTeX = specialVerbatimTeX;" ;
local function protecttextext(data)
local everymplib = tex.toks['everymplibtoks'] or ''
local everyendmplib = tex.toks['everyendmplibtoks'] or ''
data = " " .. everymplib .."\n".. data .."\n".. everyendmplib
data = stringgsub(data, "\"[^\r\n]-\"",
data = "\n" .. everymplib .."\n".. data .."\n".. everyendmplib
data = stringgsub(data,"\r","\n")
data = stringgsub(data, "\"[^\n]-\"",
function(str)
str = stringgsub(str,"%%","****PERCENT****")
str = stringgsub(str,"([bem])tex%f[^A-Z_a-z]","%1***T***E***X***")
return str
end)
data = stringgsub(data,"%%.-[\r\n]","")
data = stringgsub(data,"%%.-\n","")
data = stringgsub(data,
"%f[A-Z_a-z]btex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]",
function(str)
str = stringgsub(str,'"','"&ditto&"')
str = stringgsub(str,"[\r\n]%s*"," ")
str = stringgsub(str,"\n%s*"," ")
return format("rawtextext(\"%s\")",str)
end)
data = stringgsub(data,
"%f[A-Z_a-z]verbatimtex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]",
function(str)
str = stringgsub(str,'"','"&ditto&"')
str = stringgsub(str,"[\r\n]%s*"," ")
str = stringgsub(str,"\n%s*"," ")
return format("VerbatimTeX(\"%s\")",str)
end)
data = stringgsub(data, "\"[^\r\n]-\"",
data = stringgsub(data, "\"[^\n]-\"",
function(str)
str = stringgsub(str,"([bem])***T***E***X***","%1tex")
str = stringgsub(str,"{", "****LEFTBRCE****")
Expand Down Expand Up @@ -1325,7 +1328,7 @@ luamplib.colorconverter = colorconverter
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
[2014/02/23 v2.5.2 mplib package for LuaTeX]
[2014/02/24 v2.5.2 mplib package for LuaTeX]
\RequirePackage{luatexbase-modutils}
\RequirePackage{pdftexcmds}
\fi
Expand Down Expand Up @@ -1364,7 +1367,7 @@ luamplib.colorconverter = colorconverter
\def\mplibsetupcatcodes{%
%catcode`\{=12 %catcode`\}=12
\catcode`\#=12 \catcode`\^=12 \catcode`\~=12 \catcode`\_=12
\catcode`\&=12 \catcode`\$=12 \catcode`\%=12 \endlinechar10
\catcode`\&=12 \catcode`\$=12 \catcode`\%=12 \catcode`\^^M=12 \endlinechar=10
}
% \end{macrocode}
%
Expand Down

0 comments on commit 97025d1

Please sign in to comment.