/* Part of Extended Libraries for SWI-Prolog Author: Edison Mera E-mail: efmera@gmail.com WWW: https://github.com/edisonm/xlibrary Copyright (C): 2016, Process Design Center, Breda, The Netherlands. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. */ :- module(codes_html, [code_html/3, % ?Code, ?Html, ?Tail codes_html/2, % +Codes, ?Html codes_html/3 % +Codes, ?Html, ?Tail ]). codes_html(Codes, Html) :- codes_html(Codes, Html, []). codes_html(Codes) --> foldl(code_html_nf, Codes). code_html_nf(Code) --> code_html(Code), !. code_html_nf(Code) --> [Code]. % escape characters taken from: % http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php code_html(0'") --> """. % quotation mark code_html(0'') --> "'". % apostrophe code_html(0'&) --> "&". % ampersand code_html(0'<) --> "<". % less-than code_html(0'>) --> ">". % greater-than code_html(0' ) --> " ". % non-breaking space code_html(0'¡) --> "¡". % inverted exclamation mark code_html(0'¢) --> "¢". % cent code_html(0'£) --> "£". % pound sterling code_html(0'¤) --> "¤". % currency code_html(0'¥) --> "¥". % yen code_html(0'¦) --> "¦". % broken vertical bar code_html(0'§) --> "§". % section code_html(0'¨) --> "¨". % spacing diaeresis code_html(0'©) --> "©". % copyright code_html(0'ª) --> "ª". % feminine ordinal indicator code_html(0'«) --> "«". % angle quotation mark (left) code_html(0'¬) --> "¬". % negation code_html(0'&) --> "hy;". % soft hyphen code_html(0'®) --> "®". % registered trademark code_html(0'¯) --> "¯". % spacing macron code_html(0'°) --> "°". % degree code_html(0'±) --> "±". % plus-or-minus code_html(0'²) --> "²". % superscript 2 code_html(0'³) --> "³". % superscript 3 code_html(0'´) --> "´". % spacing acute code_html(0'µ) --> "µ". % micro code_html(0'¶) --> "¶". % paragraph code_html(0'·) --> "·". % middle dot code_html(0'¸) --> "¸". % spacing cedilla code_html(0'¹) --> "¹". % superscript 1 code_html(0'º) --> "º". % masculine ordinal indicator code_html(0'») --> "»". % angle quotation mark (right) code_html(0'¼) --> "¼". % fraction 1/4 code_html(0'½) --> "½". % fraction 1/2 code_html(0'¾) --> "¾". % fraction 3/4 code_html(0'¿) --> "¿". % inverted question mark code_html(0'×) --> "×". % multiplication code_html(0'÷) --> "÷". % division code_html(0'À) --> "À". % capital a, grave accent code_html(0'Á) --> "Á". % capital a, acute accent code_html(0'Â) --> "Â". % capital a, circumflex accent code_html(0'Ã) --> "Ã". % capital a, tilde code_html(0'Ä) --> "Ä". % capital a, umlaut mark code_html(0'Å) --> "Å". % capital a, ring code_html(0'Æ) --> "Æ". % capital ae code_html(0'Ç) --> "Ç". % capital c, cedilla code_html(0'È) --> "È". % capital e, grave accent code_html(0'É) --> "É". % capital e, acute accent code_html(0'Ê) --> "Ê". % capital e, circumflex accent code_html(0'Ë) --> "Ë". % capital e, umlaut mark code_html(0'Ì) --> "Ì". % capital i, grave accent code_html(0'Í) --> "Í". % capital i, acute accent code_html(0'Î) --> "Î". % capital i, circumflex accent code_html(0'Ï) --> "Ï". % capital i, umlaut mark code_html(0'Ð) --> "Ð". % capital eth, Icelandic code_html(0'Ñ) --> "Ñ". % capital n, tilde code_html(0'Ò) --> "Ò". % capital o, grave accent code_html(0'Ó) --> "Ó". % capital o, acute accent code_html(0'Ô) --> "Ô". % capital o, circumflex accent code_html(0'Õ) --> "Õ". % capital o, tilde code_html(0'Ö) --> "Ö". % capital o, umlaut mark code_html(0'Ø) --> "Ø". % capital o, slash code_html(0'Ù) --> "Ù". % capital u, grave accent code_html(0'Ú) --> "Ú". % capital u, acute accent code_html(0'Û) --> "Û". % capital u, circumflex accent code_html(0'Ü) --> "Ü". % capital u, umlaut mark code_html(0'Ý) --> "Ý". % capital y, acute accent code_html(0'Þ) --> "Þ". % capital THORN, Icelandic code_html(0'ß) --> "ß". % small sharp s, German code_html(0'à) --> "à". % small a, grave accent code_html(0'á) --> "á". % small a, acute accent code_html(0'â) --> "â". % small a, circumflex accent code_html(0'ã) --> "ã". % small a, tilde code_html(0'ä) --> "ä". % small a, umlaut mark code_html(0'å) --> "å". % small a, ring code_html(0'æ) --> "æ". % small ae code_html(0'ç) --> "ç". % small c, cedilla code_html(0'è) --> "è". % small e, grave accent code_html(0'é) --> "é". % small e, acute accent code_html(0'ê) --> "ê". % small e, circumflex accent code_html(0'ë) --> "ë". % small e, umlaut mark code_html(0'ì) --> "ì". % small i, grave accent code_html(0'í) --> "í". % small i, acute accent code_html(0'î) --> "î". % small i, circumflex accent code_html(0'ï) --> "ï". % small i, umlaut mark code_html(0'ð) --> "ð". % small eth, Icelandic code_html(0'ñ) --> "ñ". % small n, tilde code_html(0'ò) --> "ò". % small o, grave accent code_html(0'ó) --> "ó". % small o, acute accent code_html(0'ô) --> "ô". % small o, circumflex accent code_html(0'õ) --> "õ". % small o, tilde code_html(0'ö) --> "ö". % small o, umlaut mark code_html(0'ø) --> "ø". % small o, slash code_html(0'ù) --> "ù". % small u, grave accent code_html(0'ú) --> "ú". % small u, acute accent code_html(0'û) --> "û". % small u, circumflex accent code_html(0'ü) --> "ü". % small u, umlaut mark code_html(0'ý) --> "ý". % small y, acute accent code_html(0'þ) --> "þ". % small thorn, Icelandic code_html(0'ÿ) --> "ÿ". % small y, umlaut mark