| 
									
										
										
										
											2009-01-15 23:20:24 -05:00
										 |  |  | ! Copyright (C) 2009 Daniel Ehrenberg. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							|  |  |  | USING: assocs io.encodings.binary io.files kernel namespaces sequences | 
					
						
							| 
									
										
										
										
											2009-01-23 16:29:28 -05:00
										 |  |  | values xml xml.entities accessors xml.state ;
 | 
					
						
							| 
									
										
										
										
											2009-01-15 23:20:24 -05:00
										 |  |  | IN: xml.entities.html | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | VALUE: html-entities | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : read-entities-file ( file -- table )
 | 
					
						
							| 
									
										
										
										
											2009-01-23 16:29:28 -05:00
										 |  |  |     file>dtd entities>> ;
 | 
					
						
							| 
									
										
										
										
											2009-01-15 23:20:24 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : get-html ( -- table )
 | 
					
						
							|  |  |  |     { "lat1" "special" "symbol" } [ | 
					
						
							| 
									
										
										
										
											2009-02-15 20:53:21 -05:00
										 |  |  |         "vocab:xml/entities/html/xhtml-" | 
					
						
							| 
									
										
										
										
											2009-01-15 23:20:24 -05:00
										 |  |  |         swap ".ent" 3append read-entities-file | 
					
						
							|  |  |  |     ] map first3 assoc-union assoc-union ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | get-html to: html-entities | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : with-html-entities ( quot -- )
 | 
					
						
							|  |  |  |     html-entities swap with-entities ; inline
 |