Initial commit

This commit is contained in:
Michael Becker 2024-06-09 00:27:31 -04:00
parent c0a4f4bb38
commit d1663084e9
16 changed files with 213 additions and 0 deletions

BIN
FileSystem/7ZDataFormat.7z Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

6
Markup/SXML/README Normal file
View File

@ -0,0 +1,6 @@
https://en.wikipedia.org/wiki/SXML
The SXMLDataFormat should inherit from
SymbolicExpressionDataFormat so we can
take advantage of only having to write
S-expr parsing once!

11
Markup/SXML/example1.html Normal file
View File

@ -0,0 +1,11 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
<head>
<title>An example page</title>
</head>
<body>
<h1 id="greeting">Hi, there!</h1>
<p>This is just an "&gt;&gt;example&lt;&lt;" to show XHTML &amp; SXML.</p>
</body>
</html>

View File

@ -0,0 +1,7 @@
(*TOP* (@ (*NAMESPACES* (x "http://www.w3.org/1999/xhtml")))
(x:html (@ (xml:lang "en") (lang "en"))
(x:head
(x:title "An example page"))
(x:body
(x:h1 (@ (id "greeting")) "Hi, there")
(x:p "This is just an \">>example<<\" to show XHTML & SXML."))))

View File

@ -0,0 +1,5 @@
(tag (@ (attr1 "value1")
(attr2 "value2"))
(nested "Text node")
(empty))

5
Markup/SXML/example2.xml Normal file
View File

@ -0,0 +1,5 @@
<tag attr1="value1"
attr2="value2">
<nested>Text node</nested>
<empty/>
</tag>

33
Markup/TODO Normal file
View File

@ -0,0 +1,33 @@
SOX - Simple Outline XML
https://en.wikipedia.org/wiki/Simple_Outline_XML
writing:
html>
xmlns=http://www.w3.org/1999/xhtml
head>
title> Sample page
body>
p> A very brief page
results in:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample page</title>
</head>
<body>
<p>A very brief page</p>
</body>
</html>
HAML - a compact form of XML/HTML
https://en.wikipedia.org/wiki/Haml
writing:
%p{:class => "sample", :id => "welcome"} Hello, World!
- or -
%p.sample#welcome Hello, World!
results in:
<p class="sample" id="welcome">Hello, World!</p>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
The Universal Editor XML data format should be used to parse
HTML, XML, SGML, and anything else that uses <tag></tag> format
-->
<!DOCTYPE example PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE note
[
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]
>
<example xmlns="urn:net.alcetech.schemas.Example" xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata>
<dc:title>Example XML File</dc:title>
</metadata>
<samples>
<self_closing_key attr="value" />
<legacyHTMLKey attrWithNoQuote=value>
<p>Define your auto-closing tags (like BR, HR, and P) in XMLDataFormat.AutoCloseTagNames </P>
<DIV>Yes, the case mismatch is intentional here, even though it drives my OCD mad</div>
</legacyHTMLKey>
<![CDATA[
This is an example CDATA section.
]]>
<?php
// example Preprocessor Directive section, anything can go here...
?>
<%
// example Preprocessor Directive section with type ASP.NET (%)
// anything can go here as well, just make sure you register your
// custom preprocessor directive prefix in XMLDataFormat.PreprocessorDirectives!
%>
</samples>
</example>

View File

@ -0,0 +1,38 @@
// Extended INI Data Format
// One of my very first custom data formats
//
// I needed something quick and easy, but more versatile
// than plain-old INI. So I decided to combine C-like
// syntax and INI properties; this was the result.
group1
{
groups can be nested {
// make sure inline braces get parsed correctly
nested key=nested value
semicolons are optional=but they could be parsed; to allow multiple keys=on the same line
// end of lines automatically end the property, just like plain INI
}
the sky's the limit
{
here's another one
{
oh boy
{
and yes=all the spaces should be preserved!
}
}
}
}
// new to this version of Editor, we should support syntax like this:
lazy_list_test
{
value 1
value 2
value 3
}
// this would simply create three properties with those names, and NULL as their value
// some C-like configuration languages use this syntax to declare stuff

View File

@ -0,0 +1,18 @@
[Section]
# Key Comment, can be ignored or preserved
Key1=Value1
Key2="Quoted values should preserve spaces, remove quotes"
Key3=Unquoted values probably should preserve spaces too
InlineKeyComment=Value # not sure what GetPrivateProfileString does here
# Section Comment
# Comments may be ignored, or preserved
[Section with Spaces which should be Preserved]
Section2Key1=Value2
StronglyTypedTestInt32=2 # this should be cast to Int32
StronglyTypedTestDouble=3.5
StronglyTypedTestBoolean=false
[FakeHierarchy:ConfigurableSeparator:Section]
WeCanDoThat=Too!
Can keys have spaces?=Probably, why not?

View File

@ -0,0 +1,16 @@
// JSON does not technically support comments, but this is our own parser, so who cares :)
{
"key": "string value",
"bool": true,
"int32": 32046,
"double": 32.91568,
"array": [
"hi",
"arrays aren't type safe",
42
],
"nested object": {
"oops": "I did it again",
"nested array": [ 2, 4, 6, 8, "who do we appreciate?" ]
}
}

35
mkfs.examples Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# This script was used to generate FileSystem example archives
# Until it occurred to me that on platforms other than Linux
# these utilities are not really that easily useful... :(
FILELIST="Markup/XML/XMLDataFormat.xml Markup/TODO LICENSE README.md"
if [ ! -d FileSystem ]; then
mkdir FileSystem
fi
echo $FILELIST
echo "Generating PKZIP example archive..."
zip ZIPDataFormat.zip $FILELIST
echo "Generating 7-Zip example archive..."
7z a 7ZDataFormat.7z $FILELIST
echo "Generating CPIO example archive..."
echo $FILELIST | tr ' ' '\n' > filelist.tmp
cpio -v --create < filelist.tmp > CPIODataFormat.cpio
rm filelist.tmp
echo "Generating TAR example archive..."
tar cfv TARDataFormat.tar $FILELIST
mv ./ZIPDataFormat.zip ./FileSystem
mv ./7ZDataFormat.7z ./FileSystem
mv ./CPIODataFormat.cpio ./FileSystem
mv ./TARDataFormat.tar ./FileSystem
cp ./FileSystem/TARDataFormat.tar ./FileSystem/TarXzDataFormat.tar
xz ./FileSystem/TarXzDataFormat.tar