google / hrx Goto Github PK
View Code? Open in Web Editor NEWHRX (Human-Readable Archive): a plain text archive format
License: Apache License 2.0
HRX (Human-Readable Archive): a plain text archive format
License: Apache License 2.0
I recently had the idea of creating a plain text archive format, searched the web and found this project, which is precisely what I was looking for. I needed a Java implementation though and decided I would implement an I/O library for Java for hrx instead of rolling my own custom archive format. I just found the time to do it yesterday and here are the results: https://github.com/topobyte/hrx-java
I implemented a test case for each of the example files, however I'm not 100% sure my implementation behaves exactly as specified / the same as the ruby implementation concerning trailing newlines. I think it would be very useful to have a set of testing files as a reference for current and future implementing developers. As a start, how about creating an extracted version of all the example files, i.e. we could have a directory extracted-examples
containing a directory X
for each X.hrx
from examples
. I'm not too fluent in setting up ruby and gems, so I would appreciate if you could create such a reference data set by unpacking all examples into corresponding directories and pushing it here. Thanks!
What do you think about having a list of implementations somewhere in the README?
I have found those so far:
Are there any more that you're aware of?
Hi! I've recently been working on a Rust implementation for this, and found a few corner cases where the syntax from the README didn't match up with the examples:
The straightforwardest one is probably the duplicate-despite-quotes.hrx
part of example/invalid/duplicates.hrx
– it looks like (syntax says naught, #1) quotes are no longer specialcased?
The next one I ran into was duplicate-files.hrx
from that same file – that archive should, according to the spec, (a) be valid and (b) contain <======> file\n
.
I think so due to the following: contents
is defined as "any sequence of characters that does not include U+000A LINE FEED followed immediately by boundary
", and file
as boundary " "+ path newline body?
.
Now, given a buffer containing
<======> file
A BCD EF
<======> file
We can see, that the AB span matches boundary
, C – the spaces, DE – path
, and F – newline
. What is left? To match the optional body
, which consists of the following:
<======> file
Note, how this chunk doesn't start with U+000A LINE FEED, despite the line starting with boundary
. This means, that the file contents continue until EOF.
The third mismatched example plagues example/empty-file.hrx
. Assuming the same symbols as before, we get (after the first comment)
<===> file1
A BCD EF
<===>
So is this one.
<===> file2
thereby hitting the first LF+boundary sequence on the line declaring file2
(my parser returns {file1: {cmt: "This file is empty.", ctnt: "<===>\nSo is this one."}, file2: { cmt: null, ctnt: "" }}
, which I feel is correct, going solely by the syntax?).
My hunch as to why these weren't noticed earlier is due to the usage of splitting parsers (e.g. in hrx.js
and hrx.py
), which probably handle these examples as expected.
I'd be more than happy to submit a PR addressing these issues, if deemed valid :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.