This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -0,0 +1,40 @@
Data "April", "Bubbly: I'm > Tam and <= Emily", _
"Tam O'Shanter", "Burns: ""When chapman billies leave the street ...""", _
"Emily", "Short & shrift"
Declare Function xmlquote(ByRef s As String) As String
Dim n As Integer, dev As String, remark As String
Print "<CharacterRemarks>"
For n = 0 to 2
Read dev, remark
Print " <Character name="""; xmlquote(dev); """>"; _
xmlquote(remark); "</Character>"
Next
Print "</CharacterRemarks>"
End
Function xmlquote(ByRef s As String) As String
Dim n As Integer
Dim r As String
For n = 0 To Len(s)
Dim c As String
c = Mid(s,n,1)
Select Case As Const Asc(c)
Case Asc("<")
r = r + "&lt;"
Case Asc(">")
r = r + "&gt;"
Case Asc("&")
r = r + "&amp;"
Case Asc("""")
r = r + "&quot;"
Case Asc("'")
r = r + "&apos;"
Case Else
r = r + c
End Select
Next
Function = r
End Function

View file

@ -0,0 +1,29 @@
100 Q$ = CHR$(34)
110 DE$(0) = "April"
120 RE$(0) = "Bubbly: I'm > Tam and <= Emily"
130 DE$(1) = "Tam O'Shanter"
140 RE$(1) = "Burns: " + Q$ + "When chapman billies leave the street ..." + Q$
150 DE$(2) = "Emily"
160 RE$(2) = "Short & shrift"
200 Print "<CharacterRemarks>"
210 For I = 0 to 2
220 Print " <Character name="Q$;
230 X$=DE$(I) : GOSUB 300xmlquote
240 PRINT Q$">";
250 X$=RE$(I) : GOSUB 300xmlquote
260 PRINT "</Character>"
270 Next
280 Print "</CharacterRemarks>"
290 End
300 For n = 1 To Len(X$)
310 c$ = Mid$(X$,n,1)
320 IF C$ = "<" THEN C$ = "&lt;"
330 IF C$ = ">" THEN C$ = "&gt;"
340 IF C$ = "&" THEN C$ = "&amp;"
350 IF C$ = Q$ THEN C$ = "&quot;"
360 IF C$ = "'" THEN C$ = "&apos;"
370 PRINT C$;
380 NEXT N
390 RETURN

View file

@ -0,0 +1,112 @@
( ( 2XML
= PCDATAentities attributeValueEntities doAll doAttributes
, xml
. ( attributeValueEntities
= a c
. @( !arg
: ?a
(("<"|"&"|\"):?c)
?arg
)
& !a
"&"
( !c:"<"&lt
| !c:"&"&amp
| quot
)
";"
attributeValueEntities$!arg
| !arg
)
& ( PCDATAentities
= a c
. @( !arg
: ?a
(("<"|"&"|">"):?c)
?arg
)
& !a
"&"
( !c:"<"&lt
| !c:"&"&amp
| gt
)
";"
PCDATAentities$!arg
| !arg
)
& ( doAttributes
= a v
. !arg:(?a.?v) ?arg
& " "
PCDATAentities$!a
"=\""
attributeValueEntities$!v
\"
doAttributes$!arg
|
)
& ( doAll
= xml first A B C att XML
. !arg:?xml
& :?XML
& whl
' ( !xml:%?first ?xml
& ( !first:(?A.?B)
& ( !B:(?att,?C)
& !XML
( !C:
& "<" !A doAttributes$!att " />\n"
| "<"
!A
doAttributes$!att
">"
doAll$!C
"</"
!A
">\n"
)
: ?XML
| !A
: ( "!"&!XML "<!" !B ">":?XML
| "!--"
& !XML "<!--" !B "-->":?XML
| "?"&!XML "<?" !B "?>\n":?XML
| "![CDATA["
& !XML "<![CDATA[" !B "]]>":?XML
| "!DOCTYPE"
& !XML "<!DOCTYPE" !B ">":?XML
| ?
& !XML "<" !A doAttributes$!B ">":?XML
)
)
| !XML PCDATAentities$!first:?XML
)
)
& str$!XML
)
& doAll$!arg
)
& ( makeList
= characters name names remark remarks
. !arg:(?names.?remarks)
& :?characters
& whl
' ( (!names.!remarks)
: (%?name ?names.%?remark ?remarks)
& !characters (Character.(name.!name),!remark)
: ?characters
)
& ("?".xml) (CharacterRemarks.,!characters)
)
& put
$ ( 2XML
$ ( makeList
$ ( April "Tam O'Shanter" Emily
. "Bubbly: I'm > Tam and <= Emily"
"Burns: \"When chapman billies leave the street ...\""
"Short & shrift"
)
)
)
)

View file

@ -0,0 +1,5 @@
<?xml?>
<CharacterRemarks><Character name="April">Bubbly: I'm &gt; Tam and &lt;= Emily</Character>
<Character name="Tam O'Shanter">Burns: "When chapman billies leave the street ..."</Character>
<Character name="Emily">Short &amp; shrift</Character>
</CharacterRemarks>