diff options
author | Karl Berry <karl@freefriends.org> | 2023-01-27 22:03:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-01-27 22:03:16 +0000 |
commit | 1da925bfdfd3a2f6a89b3c338a3ee82f45dabde8 (patch) | |
tree | 17b6a6837e0dc19e9f949c029fdb90dbc0c2dced /Master/texmf-dist/tex/lualatex/luaquotes | |
parent | bf8a80959e4fa6f97f44ee0583a5c3ba663ce2c8 (diff) |
luaquotes (26jan23)
git-svn-id: svn://tug.org/texlive/trunk@65652 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/luaquotes')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luaquotes/luaquotes.sty | 84 |
1 files changed, 80 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/lualatex/luaquotes/luaquotes.sty b/Master/texmf-dist/tex/lualatex/luaquotes/luaquotes.sty index 7b93a4f9c01..c2033499eef 100644 --- a/Master/texmf-dist/tex/lualatex/luaquotes/luaquotes.sty +++ b/Master/texmf-dist/tex/lualatex/luaquotes/luaquotes.sty @@ -1,6 +1,6 @@ -\def\luaquotesversionnumber{1.3.0} +\def\luaquotesversionnumber{1.4.0} \ProvidesPackage{luaquotes} - [2023/15/15\luaquotesversionnumber smart quotes with lua] + [2023/01/25\luaquotesversionnumber smart quotes with lua] % !TeX program = lualatex % !TeX encoding = utf8 % This work may be distributed and/or modified under the @@ -182,6 +182,33 @@ luatexbase.add_to_callback ( \newcommand\frsinglequotespcloseoff{\directlua{luatexbase.remove_from_callback ( "process_input_buffer" , "frpsinglequotesclose" )}} +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DECH Parentheses +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\sglmtlpdech}{{\addfontfeature{RawFeature={-qtbye,-tlig}}‹}} +\newcommand{\sglmtrpdech}{{\addfontfeature{RawFeature={-qtbye,-tlig}}›}} + +\luaexec{function dechpsinglequotes ( s ) + return ( s:gsub ( "\%('",[[(\sglmtlpdech]]) ) + end} +\luaexec{function dechpsinglequotesclose ( s ) + return ( s:gsub ( "'\%)",[[\sglmtrpdech)]]) ) + end} + +\newcommand\dechsinglequotespon{\directlua{ +luatexbase.add_to_callback ( + "process_input_buffer" , dechpsinglequotes , "dechpsinglequotes" ) + }} +\newcommand\dechsinglequotespoff{\directlua{luatexbase.remove_from_callback ( + "process_input_buffer" , "dechpsinglequotes" )}} +\newcommand\dechsinglequotespcloseon{\directlua{ +luatexbase.add_to_callback ( + "process_input_buffer" , dechpsinglequotesclose , "dechpsinglequotesclose" ) + }} +\newcommand\dechsinglequotespcloseoff{\directlua{luatexbase.remove_from_callback ( + "process_input_buffer" , "dechpsinglequotesclose" )}} %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -237,7 +264,7 @@ luatexbase.add_to_callback ( } \DeclareOption{en}{ -\AtBeginDocument{\frsmartquotes\frdumbquotes\desmartquotes\dedumbquotes\degmsmartquotes\degmdumbquotes\smartquotes} +\AtBeginDocument{\dechsmartquotes\dechdumbquotes\frsmartquotes\frdumbquotes\desmartquotes\dedumbquotes\degmsmartquotes\degmdumbquotes\smartquotes} \renewcommand{\texttt}[1]{{\ttfamily\addfontfeature{RawFeature={+qtbye,-tlig}} #1}} } @@ -360,6 +387,7 @@ return ( s:gsub ( " '(..-)'", " ‚\%1`" ) ) } \DeclareOption{de}{ \AtBeginDocument{ +\dechsmartquotes\dechdumbquotes \frsmartquotes \frdumbquotes \smartquotes @@ -404,6 +432,7 @@ return ( s:gsub ( " '(..-)'", " ‚\%1‹" ) ) \degmsinglequotescloseoff} \DeclareOption{degm}{ \AtBeginDocument{ +\dechsmartquotes\dechdumbquotes \frsmartquotes \frdumbquotes \smartquotes @@ -453,13 +482,60 @@ return ( s:gsub ( " '(..-)'", " ‹\\,\%1\\,›" ) ) \frsinglequotelinestartoff \frsinglequotescloseoff} \DeclareOption{fr}{ -\AtBeginDocument{\desmartquotes\dedumbquotes\degmsmartquotes\degmdumbquotes\smartquotes\dumbquotes\dumbquotes\frsmartquotes} +\AtBeginDocument{\dechsmartquotes\dechdumbquotes\desmartquotes\dedumbquotes\degmsmartquotes\degmdumbquotes\smartquotes\dumbquotes\dumbquotes\frsmartquotes} \renewcommand{\texttt}[1]{{\ttfamily\addfontfeature{RawFeature={+qtbye,-tlig}} #1}} } %%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Deutsch (Schweiz) +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +\luaexec{function dechdoublequotes ( s ) + return ( s:gsub ( '"(..-)"' , "«\%1»" ) ) + end} + + +\luaexec{function dechsinglequotelinestart ( s ) + return (s:gsub ("^'","'" ) ) + end} +\luaexec{function dechsinglequotesclose( s ) +return ( s:gsub ( " '(..-)'", " ‹\%1›" ) ) + end} +%% Two utility macros to activate/deactivate the Lua function: +\newcommand\dechdoublequoteson{\directlua{luatexbase.add_to_callback ( + "process_input_buffer" ,dechdoublequotes , "dechdoublequotes" )}} +\newcommand\dechdoublequotesoff{\directlua{luatexbase.remove_from_callback ( + "process_input_buffer" , "dechdoublequotes" )}} +\newcommand\dechsinglequotelinestarton{\directlua{luatexbase.add_to_callback ( + "process_input_buffer" ,dechsinglequotelinestart , "dechsinglequotelinestart" )}} +\newcommand\dechsinglequotelinestartoff{\directlua{luatexbase.remove_from_callback ( + "process_input_buffer" , "dechsinglequotelinestart" )}} + \newcommand\dechsinglequotescloseon{\directlua{luatexbase.add_to_callback ( + "process_input_buffer" ,dechsinglequotesclose , "dechsinglequotesclose" )}} +\newcommand\dechsinglequotescloseoff{\directlua{luatexbase.remove_from_callback ( + "process_input_buffer" , "dechsinglequotesclose" )}} + \newcommand{\dechsmartquotes}{\dechdoublequoteson + \dechsinglequotespon + \dechsinglequotespcloseon +\dechsinglequotelinestarton +\dechsinglequotescloseon} + \newcommand{\dechdumbquotes}{\dechdoublequotesoff + \dechsinglequotespoff + \dechsinglequotespcloseoff +\dechsinglequotelinestartoff +\dechsinglequotescloseoff} + \DeclareOption{dech}{ +\AtBeginDocument{\desmartquotes\dedumbquotes\degmsmartquotes\degmdumbquotes\smartquotes\dumbquotes\dumbquotes\frsmartquotes\frdumbquotes\dechsmartquotes} +\renewcommand{\texttt}[1]{{\ttfamily\addfontfeature{RawFeature={+qtbye,-tlig}} #1}} + + +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%% % Default option is English %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% |