ó Ž ËPc@s}dZddlZd„ZdZdZdZdZejdefƒZejd efƒZ ejd ƒZ ejd ƒZ ejd ƒZ ejd efej ƒZejdeefej ƒZejdefej ƒZejdefej ƒZejdefej ƒZejdefej ƒZd„Zdd„Zd„Zd„Zd„Zd„Zd„ZdS(s³ This is based on SmartyPants.py by `Chad Miller`_ , version 1.5_1.6. Copyright and License ===================== SmartyPants_ license:: Copyright (c) 2003 John Gruber (http://daringfireball.net/) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name "SmartyPants" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. smartypants.py license:: smartypants.py is a derivative work of SmartyPants. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. .. _Chad Miller: http://web.chad.org/ iÿÿÿÿNcCs@|jddƒ}t|ƒ}t|ƒ}|jddƒ}|S(Ns"t"(treplaceteducate_dashes_oldschoolteducate_quotes(tt((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pytsphinx_smarty_pantsMs   s)[!"#\$\%'()*+,-.\/:;<=>?\@\[\\\]\^_`{|}~]s [\s.,;:!?)]s[^\ \t\r\n\[\{\(\-]s–|—s ^'(?=%s\\B)s ^"(?=%s\\B)s"'(?=\w)s'"(?=\w)s \b'(?=\d{2}s)s ( \s | # a whitespace char, or   | # a non-breaking space entity, or -- | # dashes, or &[mn]dash; | # named dash entities %s | # or decimal entities &\#x201[34]; # or hex ) " # the quote (?=\w) # followed by a word character sŠ #(%s)? # character that indicates the quote should be closing " (?=%s) sq (%s) # character that indicates the quote should be closing " s ( \s | # a whitespace char, or   | # a non-breaking space entity, or -- | # dashes, or &[mn]dash; | # named dash entities %s | # or decimal entities &\#x201[34]; # or hex ) ' # the quote (?=\w) # followed by a word character sZ (%s) ' (?!\s | s\b | \d) sS (%s) ' (\s | s\b) cCsètjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}|j dd ƒ}t jd |ƒ}t jd|ƒ}t jd |ƒ}|j d d ƒS(sÄ Parameter: String. Returns: The string, with "educated" curly quote HTML entities. Example input: "Isn't this fun?" Example output: “Isn’t this fun?” s’s”s“‘s‘“s \1‘s \1’s \1’\2t's‘s \1“s \1”Rs“( tsingle_quote_start_retsubtdouble_quote_start_retdouble_quote_sets_retsingle_quote_sets_retdecade_abbr_retopening_single_quotes_regextclosing_single_quotes_regextclosing_single_quotes_regex_2Rtopening_double_quotes_regextclosing_double_quotes_regextclosing_double_quotes_regex_2(ts((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pyRœs s``s''cCs&tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}tjd|ƒ}|j dd ƒ}t jd |ƒ}t jd|ƒ}t jd |ƒ}|j d d ƒ}|j d |dƒj d|dƒj d dƒj ddƒS(s¸ Parameter: String. Returns: The string, with double quotes corrected to LaTeX quotes. Example input: "Isn't this fun?" Example output: ``Isn't this fun?''; sssss\1s\1s\1\2Rss\1s\1Rsiit`( RRR R R R R RRRRRR(Rtdquotes((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pyteducate_quotes_latexÃs &cCs|jddƒjddƒS(sî Parameter: String. Returns: The string, with ``backticks'' -style double quotes translated into HTML curly quote entities. Example input: ``Isn't this fun?'' Example output: “Isn't this fun?” s``s“s''s”(R(R((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pyteducate_backticksîscCs|jddƒjddƒS(sñ Parameter: String. Returns: The string, with `backticks' -style single quotes translated into HTML curly quote entities. Example input: `Isn't this fun?' Example output: ‘Isn’t this fun?’ Rs‘Rs’(R(R((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pyteducate_single_backticksùs cCs|jddƒjddƒS(sÀ Parameter: String. Returns: The string, with each instance of "--" translated to an en-dash HTML entity, and each "---" translated to an em-dash HTML entity. s---s—s--s–(R(R((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pyRscCs|jddƒjddƒS(sr Parameter: String. Returns: The string, with each instance of "--" translated to an em-dash HTML entity, and each "---" translated to an en-dash HTML entity. Two reasons why: First, unlike the en- and em-dash syntax supported by educate_dashes_oldschool(), it's compatible with existing entries written before SmartyPants 1.1, back when "--" was only used for em-dashes. Second, em-dashes are more common than en-dashes, and so it sort of makes sense that the shortcut should be shorter to type. (Thanks to Aaron Swartz for the idea.) s---s–s--s—(R(R((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pyt!educate_dashes_oldschool_invertedscCs|jddƒjddƒS(sÁ Parameter: String. Returns: The string, with each instance of "..." translated to an ellipsis HTML entity. Example input: Huh...? Example output: Huh…? s...s…s. . .(R(R((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pyteducate_ellipses"s (s``s''(t__doc__treRt punct_classtend_of_word_classt close_classt dec_dashestcompileRR R R R tVERBOSERRRR RRRRRRRRR(((sA/usr/local/lib/python2.7/site-packages/sphinx/util/smartypants.pytHs<     ' +