Xhtml/Mod/EntitySets.odc

MODULE XhtmlEntitySets; (* SP410 *)
(**
	project	= "BlackBox"
	organization	= "www.oberon.ch"
	contributors	= "Oberon microsystems"
	version	= "System/Rsrc/About"
	copyright	= "System/Rsrc/About"
	references	= "http://www.w3.org/TR/xhtml1/DTD/HTMLlat1x.ent,
		    http://www.w3.org/TR/xhtml1/DTD/HTMLspecialx.ent,
		    http://www.w3.org/TR/xhtml1/DTD/HTMLsymbolx.ent"
	license	= "Docu/BB-License"
	changes	= "
	- 20111211, Fyodor Tkachov, switched from National to i21sysCharacters; 04FFX >> 0527X; see Unicode 6.0
	- 20071230, Boris Rumshin, правильная русификация
	- 20060407, Ilya Ermakov, russification
	- 20050811, mf (reported by Helmut Zinn), procedure MapCharToEntity: changed "ch <= 039D6X" to "ch <= 03D6X"
	"
	issues	= "
	- ...
	"

**)

	IMPORT i21sysCharacters;

(* XHTML entity sets (Latin-1 characters, special characters, symbols) according to:

	Portions (C) International Organization for Standardization 1986
	Permission to copy in any form is granted for use with
	conforming SGML systems and applications as defined in
	ISO 8879, provided this notice is included in all copies.

*)

	PROCEDURE MapCharToEntity* (ch: CHAR; OUT s: ARRAY OF CHAR);
	BEGIN
		IF ch <= 00FFX THEN	(* Latin-1 *)
			CASE ch OF
			| 0022X: s := "&quot;"
			| 0026X: s := "&amp;"
			| 003CX: s := "&lt;"
			| 003EX: s := "&gt;"
			(* character entities *)
(*			| 00A0X: s := "&nbsp;"
			| 00A1X: s := "&iexcl;"
			| 00A2X: s := "&cent;"
			| 00A3X: s := "&pound;"
			| 00A4X: s := "&curren;"
			| 00A5X: s := "&yen;"
			| 00A6X: s := "&brvbar;"
			| 00A7X: s := "&sect;"
			| 00A8X: s := "&uml;"
			| 00A9X: s := "&copy;"
			| 00AAX: s := "&ordf;"
			| 00ABX: s := "&laquo;"
			| 00ACX: s := "&not;"
			| 00ADX: s := "&shy;"
			| 00AEX: s := "&reg;"
			| 00AFX: s := "&macr;"
			| 00B0X: s := "&deg;"
			| 00B1X: s := "&plusmn;"
			| 00B2X: s := "&sup2;"
			| 00B3X: s := "&sup3;"
			| 00B4X: s := "&acute;"
			| 00B5X: s := "&micro;"
			| 00B6X: s := "&para;"
			| 00B7X: s := "&middot;"
			| 00B8X: s := "&cedil;"
			| 00B9X: s := "&sup1;"
			| 00BAX: s := "&ordm;"
			| 00BBX: s := "&raquo;"
			| 00BCX: s := "&frac14;"
			| 00BDX: s := "&frac12;"
			| 00BEX: s := "&frac34;"
			| 00BFX: s := "&iquest;"
			| 00C0X: s := "&Agrave;"
			| 00C1X: s := "&Aacute;"
			| 00C2X: s := "&Acirc;"
			| 00C3X: s := "&Atilde;"
			| 00C4X: s := "&Auml;"
			| 00C5X: s := "&Aring;"
			| 00C6X: s := "&AElig;"
			| 00C7X: s := "&Ccedil;"
			| 00C8X: s := "&Egrave;"
			| 00C9X: s := "&Eacute;"
			| 00CAX: s := "&Ecirc;"
			| 00CBX: s := "&Euml;"
			| 00CCX: s := "&Igrave;"
			| 00CDX: s := "&Iacute;"
			| 00CEX: s := "&Icirc;"
			| 00CFX: s := "&Iuml;"
			| 00D0X: s := "&ETH;"
			| 00D1X: s := "&Ntilde;"
			| 00D2X: s := "&Ograve;"
			| 00D3X: s := "&Oacute;"
			| 00D4X: s := "&Ocirc;"
			| 00D5X: s := "&Otilde;"
			| 00D6X: s := "&Ouml;"
			| 00D7X: s := "&times;"
			| 00D8X: s := "&Oslash;"
			| 00D9X: s := "&Ugrave;"
			| 00DAX: s := "&Uacute;"
			| 00DBX: s := "&Ucirc;"
			| 00DCX: s := "&Uuml;"
			| 00DDX: s := "&Yacute;"
			| 00DEX: s := "&THORN;"
			| 00DFX: s := "&szlig;"
			| 00E0X: s := "&agrave;"
			| 00E1X: s := "&aacute;"
			| 00E2X: s := "&acirc;"
			| 00E3X: s := "&atilde;"
			| 00E4X: s := "&auml;"
			| 00E5X: s := "&aring;"
			| 00E6X: s := "&aelig;"
			| 00E7X: s := "&ccedil;"
			| 00E8X: s := "&egrave;"
			| 00E9X: s := "&eacute;"
			| 00EAX: s := "&ecirc;"
			| 00EBX: s := "&euml;"
			| 00ECX: s := "&igrave;"
			| 00EDX: s := "&iacute;"
			| 00EEX: s := "&icirc;"
			| 00EFX: s := "&iuml;"
			| 00F0X: s := "&eth;"
			| 00F1X: s := "&ntilde;"
			| 00F2X: s := "&ograve;"
			| 00F3X: s := "&oacute;"
			| 00F4X: s := "&ocirc;"
			| 00F5X: s := "&otilde;"
			| 00F6X: s := "&ouml;"
			| 00F7X: s := "&divide;"
			| 00F8X: s := "&oslash;"
			| 00F9X: s := "&ugrave;"
			| 00FAX: s := "&uacute;"
			| 00FBX: s := "&ucirc;"
			| 00FCX: s := "&uuml;"
			| 00FDX: s := "&yacute;"
			| 00FEX: s := "&thorn;"
			| 00FFX: s := "&yuml;" *)
			ELSE
				s[0] := i21sysCharacters.UnicodeOf(ch); s[1] := 0X
			END
		ELSIF ch <= 02DCX THEN	(* Latin Extended-A and spacing modifier letters *)
			IF ch = 0152X THEN s := "&OElig;"
			ELSIF ch = 0153X THEN s := "&oelig;"
			ELSIF ch = 0160X THEN s := "&Scaron;"
			ELSIF ch = 0161X THEN s := "&scaron;"
			ELSIF ch = 0178X THEN s := "&Yuml;"
			ELSIF ch = 02C6X THEN s := "&circ;"
			ELSIF ch = 02DCX THEN s := "&tilde;"
			ELSE s := ""
			END
		ELSIF ch <= 03D6X THEN	(* greek *)
			CASE ch OF
			| 0391X: s := "&Alpha;"
			| 0392X: s := "&Beta;"
			| 0393X: s := "&Gamma;"
			| 0394X: s := "&Delta;"
			| 0395X: s := "&Epsilon;"
			| 0396X: s := "&Zeta;"
			| 0397X: s := "&Eta;"
			| 0398X: s := "&Theta;"
			| 0399X: s := "&Iota;"
			| 039AX: s := "&Kappa;"
			| 039BX: s := "&Lambda;"
			| 039CX: s := "&Mu;"
			| 039DX: s := "&Nu;"
			| 039EX: s := "&Xi;"
			| 039FX: s := "&Omicron;"
			| 03A0X: s := "&Pi;"
			| 03A1X: s := "&Rho;"
			| 03A3X: s := "&Sigma;"
			| 03A4X: s := "&Tau;"
			| 03A5X: s := "&Upsilon;"
			| 03A6X: s := "&Phi;"
			| 03A7X: s := "&Chi;"
			| 03A8X: s := "&Psi;"
			| 03A9X: s := "&Omega;"
			| 03B1X: s := "&alpha;"
			| 03B2X: s := "&beta;"
			| 03B3X: s := "&gamma;"
			| 03B4X: s := "&delta;"
			| 03B5X: s := "&epsilon;"
			| 03B6X: s := "&zeta;"
			| 03B7X: s := "&eta;"
			| 03B8X: s := "&theta;"
			| 03B9X: s := "&iota;"
			| 03BAX: s := "&kappa;"
			| 03BBX: s := "&lambda;"
			| 03BCX: s := "&mu;"
			| 03BDX: s := "&nu;"
			| 03BEX: s := "&xi;"
			| 03BFX: s := "&omicron;"
			| 03C0X: s := "&pi;"
			| 03C1X: s := "&rho;"
			| 03C2X: s := "&sigmaf;"
			| 03C3X: s := "&sigma;"
			| 03C4X: s := "&tau;"
			| 03C5X: s := "&upsilon;"
			| 03C6X: s := "&phi;"
			| 03C7X: s := "&chi;"
			| 03C8X: s := "&psi;"
			| 03C9X: s := "&omega;"
			| 03D1X: s := "&thetasym;"
			| 03D2X: s := "&upsih;"
			| 03D6X: s := "&piv;"
			ELSE s := ""
			END
		ELSIF ch <= 00527X THEN	(* Cyrillic *)
			s[0] := ch; s[1] := 0X	
		ELSIF ch <= 232AX THEN	(* general punctuation, arrows, etc. *)
			CASE ch OF
			| 2002X: s := "&ensp;"
			| 2003X: s := "&emsp;"
			| 2009X: s := "&thinsp;"
			| 2022X: s := "&bull;"
			| 2026X: s := "&hellip;"
			| 2032X: s := "&prime;"
			| 2033X: s := "&Prime;"
			| 203EX: s := "&oline;"
			| 2044X: s := "&frasl;"
			| 2070X: s := "&zwnj;"
			| 200DX: s := "&zwj;"
			| 200EX: s := "&lrm;"
			| 200FX: s := "&rlm;"
			| 2013X: s := "&ndash;"
			| 2014X: s := "&mdash;"
			| 2018X: s := "&lsquo;"
			| 2019X: s := "&rsquo;"
			| 201AX: s := "&sbquo;"
			| 201CX: s := "&ldquo;"
			| 201DX: s := "&rdquo;"
			| 201EX: s := "&bdquo;"
			| 2020X: s := "&dagger;"
			| 2021X: s := "&Dagger;"
			| 2030X: s := "&permil;"
			| 2039X: s := "&lsaquo;"
			| 203AX: s := "&rsaquo;"
			| 20ACX: s := "&euro;"
			| 2118X: s := "&weierp;"
			| 2111X: s := "&image;"
			| 211CX: s := "&real;"
			| 2122X: s := "&trade;"
			| 2135X: s := "&alefsym;"
			| 2190X: s := "&larr;"
			| 2191X: s := "&uarr;"
			| 2192X: s := "&rarr;"
			| 2193X: s := "&darr;"
			| 2194X: s := "&harr;"
			| 21B5X: s := "&crarr;"
			| 21D0X: s := "&lArr;"
			| 21D1X: s := "&uArr;"
			| 21D2X: s := "&rArr;"
			| 21D3X: s := "&dArr;"
			| 21D4X: s := "&hArr;"
			| 2200X: s := "&forall;"
			| 2202X: s := "&part;"
			| 2203X: s := "&exist;"
			| 2205X: s := "&empty;"
			| 2207X: s := "&nabla;"
			| 2208X: s := "&isin;"
			| 2209X: s := "&notin;"
			| 220BX: s := "&ni;"
			| 220FX: s := "&prod;"
			| 2211X: s := "&sum;"
			| 2212X: s := "&minus;"
			| 2217X: s := "&lowast;"
			| 221AX: s := "&radic;"
			| 221DX: s := "&prop;"
			| 221EX: s := "&infin;"
			| 2220X: s := "&ang;"
			| 2227X: s := "&and;"
			| 2228X: s := "&or;"
			| 2229X: s := "&cap;"
			| 222AX: s := "&cup;"
			| 222BX: s := "&int;"
			| 2234X: s := "&there4;"
			| 223CX: s := "&sim;"
			| 2245X: s := "&cong;"
			| 2248X: s := "&asymp;"
			| 2260X: s := "&ne;"
			| 2261X: s := "&equiv;"
			| 2264X: s := "&le;"
			| 2265X: s := "&ge;"
			| 2282X: s := "&sub;"
			| 2283X: s := "&sup;"
			| 2284X: s := "&nsub;"
			| 2286X: s := "&sube;"
			| 2287X: s := "&supe;"
			| 2295X: s := "&oplus;"
			| 2297X: s := "&otimes;"
			| 22A5X: s := "&perp;"
			| 22C5X: s := "&sdot;"
			| 2308X: s := "&lceil;"
			| 2309X: s := "&rceil;"
			| 230AX: s := "&lfloor;"
			| 230BX: s := "&rfloor;"
			| 2329X: s := "&lang;"
			| 232AX: s := "&rang;"
			ELSE
				s := ""
			END
		ELSE	(* miscellaneous other symbols *)
			IF ch = 25CAX THEN s := "&loz;"
			ELSIF ch = 2660X THEN s := "&spades;"
			ELSIF ch = 2663X THEN s := "&clubs;"
			ELSIF ch = 2665X THEN s := "&hearts;"
			ELSIF ch = 2666X THEN s := "&diams;"
			ELSE s := ""
			END
		END
	END MapCharToEntity;

END XhtmlEntitySets.