Skip to content

Commit

Permalink
[doc] fix README.rst formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq authored Mar 24, 2024
1 parent 36fef2c commit 22d297e
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ new features include
5. dynamically cache linked data files (``jsoncache``, ``jdlink``) to permit on-demand download and
processing of complex JSON-encoded datasets such as neuroimaging datasets hosted on https://neurojson.io
6. support high-performance Blosc2 meta-compressor for storing large N-D array data,
7. ``savejson/loadjson`` can use MATLAB/Octave built-in ``jsonencode/jsondecode`` using the `BuiltinJSON` option
7. ``savejson/loadjson`` can use MATLAB/Octave built-in ``jsonencode/jsondecode`` using the ``BuiltinJSON`` option
8. automatically switch from struct to containers.Map when encoded key-length exceeds 63
9. provide fall-back zlib/gzip compression/decompression function on Octave when ZMat is not installed

Expand Down Expand Up @@ -204,13 +204,13 @@ following breaking differences:
To avoid using the new features, one should attach ``'UBJSON',1`` and ``'Endian','B'``
in the ``savebj`` command as

.. code-block:: matlab
.. code-block::
savebj('',data,'FileName','myfile.bjd','UBJSON',1, 'Endian','B');
To read BJData data files generated by JSONLab v2.0, you should call

.. code-block:: matlab
.. code-block::
data=loadbj('my_old_data_file.bjd','Endian','B')
Expand Down Expand Up @@ -305,9 +305,9 @@ MATLAB running in the ``-nojvm`` mode or GNU Octave, or 'lzma/lzip/lz4/lz4hc'
compression methods are specified. ZMat can also compress large arrays that
MATLAB's Java-based compression API does not support.

----------
-------------------------------------
Install JSONLab on Fedora 24 or later
----------
-------------------------------------

JSONLab has been available as an official Fedora package since 2015. You may
install it directly using the below command
Expand All @@ -324,9 +324,9 @@ To enable data compression/decompression, you need to install ``octave-zmat`` us
Then open Octave, and type ``pkg load jsonlab`` to enable jsonlab toolbox.

----------
-------------------------
Install JSONLab on Debian
----------
-------------------------

JSONLab is currently available on Debian Bullseye. To install, you may run

Expand All @@ -336,9 +336,9 @@ JSONLab is currently available on Debian Bullseye. To install, you may run
One can alternatively install ``matlab-jsonlab`` if MATLAB is available.

----------
-------------------------
Install JSONLab on Ubuntu
----------
-------------------------

JSONLab is currently available on Ubuntu 21.04 or newer as package
`octave-jsonlab`. To install, you may run
Expand Down Expand Up @@ -366,9 +366,9 @@ to add this PPA, and then use
to install the toolbox. ``octave-zmat`` will be automatically installed.

----------
------------------------------
Install JSONLab on Arch Linux
----------
------------------------------

JSONLab is also available on Arch Linux. You may install it using the below command

Expand Down Expand Up @@ -412,7 +412,7 @@ core functions for encoding/decoding JSON/UBJSON/MessagePack data.
savejson.m
----------

.. code-block:: matlab
.. code-block::
jsonmesh=struct('MeshNode',[0 0 0;1 0 0;0 1 0;1 1 0;0 0 1;1 0 1;0 1 1;1 1 1],...
'MeshElem',[1 2 4 8;1 3 4 8;1 2 6 8;1 5 6 8;1 5 7 8;1 3 7 8],...
Expand All @@ -434,29 +434,29 @@ savejson.m
loadjson.m
----------

.. code-block:: matlab
.. code-block::
loadjson('{}')
dat=loadjson('{"obj":{"string":"value","array":[1,2,3]}}')
dat=loadjson(['examples' filesep 'example1.json'])
dat=loadjson(['examples' filesep 'example1.json'],'SimplifyCell',0)
-------------
-------------------------------------
savebj.m (saveubjson.m as an alias)
-------------
-------------------------------------

.. code-block:: matlab
.. code-block::
a={single(rand(2)), struct('va',1,'vb','string'), 1+2i};
savebj(a)
savebj('rootname',a,'testdata.ubj')
savebj('zeros',zeros(100),'Compression','gzip')
-------------
-------------------------------------
loadbj.m (loadubjson.m as an alias)
-------------
-------------------------------------

.. code-block:: matlab
.. code-block::
obj=struct('string','value','array',single([1 2 3]),'empty',[],'magic',uint8(magic(5)));
ubjdata=savebj('obj',obj);
Expand All @@ -465,20 +465,20 @@ loadbj.m (loadubjson.m as an alias)
isequaln(obj,dat.obj)
dat=loadbj(savebj('',eye(10),'Compression','zlib','CompressArraySize',1))
----------
-------------
jdataencode.m
----------
-------------

.. code-block:: matlab
.. code-block::
jd=jdataencode(struct('a',rand(5)+1i*rand(5),'b',[],'c',sparse(5,5)))
savejson('',jd)
----------
-------------
jdatadecode.m
----------
-------------

.. code-block:: matlab
.. code-block::
rawdata=struct('a',rand(5)+1i*rand(5),'b',[],'c',sparse(5,5));
jd=jdataencode(rawdata)
Expand All @@ -501,19 +501,19 @@ and ``loadubjson`` functions for various matlab data structures, and
Please run these examples and understand how JSONLab works before you use
it to process your data.

---------
------------
unit testing
---------
------------

Under the ``test`` folder, you can find a script to test individual data types and
inputs using various encoders and decoders. This unit testing script also serves as
a **specification validator** to the JSONLab functions and ensure that the outputs
are compliant to the underlying specifications.


================
========================================
Using ``jsave/jload`` to share workspace
================
========================================

Starting from JSONLab v2.0, we provide a pair of functions, ``jsave/jload`` to store
and retrieve variables from the current workspace, similar to the ``save/load``
Expand Down Expand Up @@ -541,7 +541,7 @@ The main benefits of using .pmat file to share matlab variables include
jsave.m
----------

.. code-block:: matlab
.. code-block::
jsave % save the current workspace to default.pmat
jsave mydata.pmat
Expand All @@ -553,7 +553,7 @@ jsave.m
jload.m
----------

.. code-block:: matlab
.. code-block::
jload % load variables from default.pmat to the current workspace
jload mydata.pmat % load variables from mydata.pmat
Expand All @@ -562,9 +562,9 @@ jload.m
jload('mydata.json')
================
================================================
Sharing JSONLab created data files in Python
================
================================================

Despite the use of portable data annotation defined by the JData Specification,
the output JSON files created by JSONLab are 100% JSON compatible (with
Expand Down Expand Up @@ -615,7 +615,7 @@ The above modules require built-in Python modules ``json`` and NumPy (``numpy``)

Once the necessary modules are installed, one can type ``python`` (or ``python3``), and run

.. code-block:: python
.. code-block::
import jdata as jd
import numpy as np
Expand Down Expand Up @@ -710,9 +710,9 @@ mailing list to report any questions you may have regarding JSONLab:
Acknowledgement
==========================

---------
----------
loadjson.m
---------
----------

The ``loadjson.m`` function was significantly modified from the earlier parsers
(BSD 3-clause licensed) written by the below authors
Expand All @@ -725,9 +725,9 @@ The ``loadjson.m`` function was significantly modified from the earlier parsers
http://www.mathworks.com/matlabcentral/fileexchange/20565
created on 2008/07/03

---------
-------------
loadmsgpack.m
---------
-------------

* Author: Bastian Bechtold
* URL: https://github.com/bastibe/matlab-msgpack/blob/master/parsemsgpack.m
Expand Down Expand Up @@ -761,9 +761,9 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---------
---------------------------------------------------------------------------------------
zlibdecode.m, zlibencode.m, gzipencode.m, gzipdecode.m, base64encode.m, base64decode.m
---------
---------------------------------------------------------------------------------------

* Author: Kota Yamaguchi
* URL: https://www.mathworks.com/matlabcentral/fileexchange/39526-byte-encoding-utilities
Expand Down

0 comments on commit 22d297e

Please sign in to comment.