| 
									
										
										
										
											2011-09-15 18:52:31 -04:00
										 |  |  | USING: accessors arrays assocs definitions fry generic help | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | help.markup io.streams.string kernel math namespaces parser | 
					
						
							| 
									
										
										
										
											2011-09-15 18:52:31 -04:00
										 |  |  | sequences sets strings tools.test words ;
 | 
					
						
							| 
									
										
										
										
											2008-03-01 17:00:45 -05:00
										 |  |  | IN: help.markup.tests | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | : with-markup-test ( quot -- )
 | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     [ f last-element ] dip
 | 
					
						
							|  |  |  |     '[ _ with-string-writer ] with-variable ; inline
 | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | TUPLE: blahblah quux ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "int" } [ [ { "int" } $instance ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { } [ \ quux>> print-topic ] unit-test | 
					
						
							|  |  |  | { } [ \ >>quux print-topic ] unit-test | 
					
						
							|  |  |  | { } [ \ blahblah? print-topic ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-23 01:34:02 -04:00
										 |  |  | : fooey ( -- * ) "fooey" throw ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { } [ \ fooey print-topic ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { } [ gensym print-topic ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-22 23:30:43 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "a string" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { $or string } print-element ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-22 23:30:43 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "a string or an integer" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { $or string integer } print-element ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-22 23:30:43 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "a string, a fixnum, or an integer" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { $or string fixnum integer } print-element ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-02-09 02:47:31 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | ! Layout | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "span" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { "span" } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "span1span2" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { "span1" "span2" } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "span1\n\nspan2" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { "span1" { $nl } "span2" } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "\nspan" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { { $nl } "span" } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "2 2 +\nspan" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { { $code "2 2 +" } "span" } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "2 2 +" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { { $code "2 2 +" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "span\n2 2 +" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { "span" { $code "2 2 +" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "\n2 2 +" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { { $nl } { $code "2 2 +" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "span\n\n2 2 +" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { "span" { $nl } { $code "2 2 +" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "Heading" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { { $heading "Heading" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "Heading1\n\nHeading2" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { { $heading "Heading1" } { $heading "Heading2" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "span\n\nHeading" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { "span" { $heading "Heading" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "\nHeading" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { { $nl } { $heading "Heading" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2009-10-01 13:12:54 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "span\n\nHeading" } | 
					
						
							| 
									
										
										
										
											2009-10-09 12:09:54 -04:00
										 |  |  | [ [ { "span" { $nl } { $heading "Heading" } } print-content ] with-markup-test ] unit-test | 
					
						
							| 
									
										
										
										
											2011-09-15 18:52:31 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : word-related-words ( word -- word related-words )
 | 
					
						
							|  |  |  |     dup [ "related" word-prop ] [ 1array ] bi diff ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SYMBOLS:
 | 
					
						
							|  |  |  |     1foo 2foo 3foo | 
					
						
							|  |  |  |     1bar 2bar 3bar ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     1foo { 2foo 3foo } | 
					
						
							|  |  |  |     1bar { 2bar 3bar } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     1foo { 1bar } | 
					
						
							|  |  |  |     2foo { 3foo } | 
					
						
							|  |  |  |     2bar { 3bar } | 
					
						
							|  |  |  | } [ | 
					
						
							|  |  |  |     { 1foo 2foo 3foo } related-words | 
					
						
							|  |  |  |     { 1bar 2bar 3bar } related-words | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     1foo word-related-words | 
					
						
							|  |  |  |     1bar word-related-words | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     { 2foo 3foo } related-words | 
					
						
							|  |  |  |     { 1foo 1bar } related-words | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     1foo word-related-words | 
					
						
							|  |  |  |     2foo word-related-words | 
					
						
							|  |  |  |     2bar word-related-words | 
					
						
							|  |  |  | ] unit-test |