diff options
author | Karl Berry <karl@freefriends.org> | 2024-04-26 21:26:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-04-26 21:26:55 +0000 |
commit | 252c4cb5c16dbe3af63150b6873a3e490ea995dc (patch) | |
tree | cd5ad41f824b831f6c4cb5f18b034545d6d60ccd /Master/texmf-dist/doc/latex | |
parent | cbd26dd674bcd61197d27c3dbf1722da270f78e0 (diff) |
jsonparse (26apr24)
git-svn-id: svn://tug.org/texlive/trunk@71088 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r-- | Master/texmf-dist/doc/latex/jsonparse/README.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.pdf | bin | 410605 -> 414511 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex | 26 |
3 files changed, 19 insertions, 9 deletions
diff --git a/Master/texmf-dist/doc/latex/jsonparse/README.md b/Master/texmf-dist/doc/latex/jsonparse/README.md index 6c268a9372a..b8750b8a8fa 100644 --- a/Master/texmf-dist/doc/latex/jsonparse/README.md +++ b/Master/texmf-dist/doc/latex/jsonparse/README.md @@ -1,4 +1,4 @@ -![Version 0.8.0](https://img.shields.io/badge/version-0.8.0-blue) +![Version 0.8.2](https://img.shields.io/badge/version-0.8.2-blue) # The `jsonparse` package diff --git a/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.pdf b/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.pdf Binary files differindex 3c5e5cb9593..07bb66590c9 100644 --- a/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.pdf +++ b/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.pdf diff --git a/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex b/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex index 359cab1869b..485bec0cbf0 100644 --- a/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex +++ b/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex @@ -11,8 +11,8 @@ % This work has the LPPL maintenance status `maintained'. % \documentclass[a4paper]{article} -\def\jsonparsefileversion{0.8.0} -\def\jsonparsefiledate{24 April 2024} +\def\jsonparsefileversion{0.8.2} +\def\jsonparsefiledate{26 April 2024} \usepackage[T1]{fontenc} \usepackage{Alegreya} @@ -195,6 +195,7 @@ \changes{v0.7.0}{2024/04/18}{Renaming and rearranging of keys, escaping of special JSON escape sequences added.} \changes{v0.7.1}{2024/04/20}{Access to first-level keys of object added.} \changes{v0.8.0}{2024/04/24}{Internal rewrite, escaping procedures changed.} +\changes{v0.8.2}{2024/04/26}{Bug fixes, externalizing parsed data.} \begin{document} @@ -258,18 +259,18 @@ These keys can be used to set the replacement text for the JSON escape sequences \section{Main user commands} \begin{macrodef} -|\JSONParse|{<token variable>}{<JSON string>} +|\JSONParse|[<file name>]{<token variable>}{<JSON string>} \end{macrodef} -The command \macro{\JSONParse} is used to parse a JSON string and store the parsed result in a token variable (a property list). The first argument takes the name of the token variable that is created by the command. The second argument takes the JSON string to be parsed. +The command \macro{\JSONParse} is used to parse a JSON string and store the parsed result in a token variable (a property list). The second argument takes the name of the token variable that is created by the command. The third argument takes the JSON string to be parsed. For example, using \macro{\JSONParse{\myJSONdata}{ { "key" : "value" } }}, the relevant JSON string will be parsed and the result stored in the token variable \macro{\myJSONdata} as property list. In this case, the property list only consists of one entry with the key \macro{key} and the value \macro{value}. The command \macro{\JSONParseValue{\myJSONdata}{key}}, for example, can then be used to extract the relevant value from this property list (see the description below). +The first optinal argument can be used to externalize the parsed JSON data to a file. See more on externalization in section \ref{sec:externalizing} below. + \begin{macrodef} -|\JSONParseFromFile|{<token variable>}{<JSON file>} +|\JSONParseFromFile|[<file name>]{<token variable>}{<JSON file>} \end{macrodef} -The command \macro{\JSONParseFromFile} is used to parse a JSON file and store the parsed result in a token variable (a property list). It works the same way as \macro{\JSONParse}, but instead of a JSON string, it takes as second argument the path to the JSON file relative to the working directory. - -This command will temporarily change the category code of \macro{b}, \macro{f}, \macro{n}, \macro{r}, \macro{t} and \macro{u} to 12 (other) if full escaping is activated. See more on escaping above in section \ref{sec:escaping}. +The command \macro{\JSONParseFromFile} is used to parse a JSON file and store the parsed result in a token variable (a property list). It works the same way as \macro{\JSONParse}, but instead of a JSON string, it takes as third argument the path to the JSON file relative to the working directory. \begin{macrodef} |\JSONParseKeys|{<token variable>}{<token variable>} @@ -348,6 +349,15 @@ The starred variant, \macro{\JSONParseArrayValuesMap*}, does not rescan the toke \end{macrodef} The command \macro{\JSONParseArrayCount} takes as first argument a token variable holding a parsed JSON string or JSON file and as second argument a key. It returns an integer representing the number of items contained in the selected array. +\subsection{Externalising parsed JSON data}\label{sec:externalizing} + +Parsing large JSON files can take quite a while. In order to speed up follow-up compilation runs, this package provides a way to store parsed JSON data for future use. The first opional argument of the commands \macro{\JSONParse} and \macro{\JSONParseFromFile} can be used to provide the name of a file (without file extension) that will be created in the working directory and which stores the relevant information. The file name will have the extension \macro{.jsonparse}. If a file with the same name and file extension already exists, an error will be issued. Once the file has been created, the package will try to load the data from this file instead of parsing the JSON data again. + +\begin{macrodef} +|\JSONParsePut|{<token variable>}{<key>}[<JSON string>] +\end{macrodef} +The commannd \macro{\JSONParsePut} is used by the externalization procedure to re-read already parsed JSON data to the main file. It essentially just adds a key-value pair to a property list (where the value part is read as string). Hence, it can also be used to append more entries to an already existing property list containing parsed JSON data. + \subsection{Changing separators, output and other settings}\label{sec:settings} The package provides a set of keys can be set to change the separators used to select the relevant value in the JSON structure, the output that is generated from the JSON data as well as other things. |