Browse Source

LaTeX compilation of URLs containing weird characters works

pull/213/head
Louis 9 years ago
parent
commit
24515962f1
  1. 4
      patacrep/data/templates/styles/crepbook.sty
  2. 2
      patacrep/templates.py
  3. 4
      test/test_book/special.tex.control

4
patacrep/data/templates/styles/crepbook.sty

@ -79,8 +79,8 @@
% Title page % Title page
\long\def\subtitle#1{\long\def\@subtitle{#1}} \long\def\subtitle#1{\long\def\@subtitle{#1}}
\def\version#1{\def\@version{#1}} \def\version#1{\def\@version{#1}}
\def\web#1{\def\@web{#1}} \def\web#1{\def\@web{\url{#1}}}
\def\mail#1{\def\@mail{#1}} \def\mail#1{\def\@mail{\href{mailto:#1}{\nolinkurl{#1}}}}
\def\email#1{\def\@email{#1}} \def\email#1{\def\@email{#1}}
\def\picture#1{\def\@picture{#1}} \def\picture#1{\def\@picture{#1}}
\def\picturecopyright#1{\def\@picturecopyright{#1}} \def\picturecopyright#1{\def\@picturecopyright{#1}}

2
patacrep/templates.py

@ -56,6 +56,8 @@ TRANSLATION_MAP_URL = {
'}': '\\' + urllib.parse.quote("}"), '}': '\\' + urllib.parse.quote("}"),
'%': '\\%', '%': '\\%',
'\\': '\\\\', '\\': '\\\\',
'#': '\\#',
'&': '\\&',
} }
def _escape_specials(text, *, chars=None, translation_map=None): def _escape_specials(text, *, chars=None, translation_map=None):

4
test/test_book/special.tex.control

@ -101,8 +101,8 @@ guitar,
\subtitle{\& \% \$ \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{}} \subtitle{\& \% \$ \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{}}
\mail{foo@\\\%&$#_~^\%20\%7B\%7D} \mail{foo@\\\%\&$\#_~^\%20\%7B\%7D}
\web{http://\\\%&$#_~^\%20\%7B\%7D} \web{http://\\\%\&$\#_~^\%20\%7B\%7D}
\picture{img/treble_a} \picture{img/treble_a}
\picturecopyright{Dbolton \url{http://commons.wikimedia.org/wiki/User:Dbolton}} \picturecopyright{Dbolton \url{http://commons.wikimedia.org/wiki/User:Dbolton}}
\footer{Generated using Songbook (\url{http://www.patacrep.com})} \footer{Generated using Songbook (\url{http://www.patacrep.com})}

Loading…
Cancel
Save