diff options
-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 | 519126 -> 518865 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex | 8 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty | 90 |
4 files changed, 56 insertions, 44 deletions
diff --git a/Master/texmf-dist/doc/latex/jsonparse/README.md b/Master/texmf-dist/doc/latex/jsonparse/README.md index dc7757b826d..dc55f606636 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.9.8](https://img.shields.io/badge/version-0.9.8-blue) +![Version 0.9.9](https://img.shields.io/badge/version-0.9.9-blue) ![Jason, the JSON parsing horse](https://github.com/jasperhabicht/jsonparse/assets/6378801/ddfddc70-bf5f-4121-ba45-4b9128875d85) 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 1555c7088a6..997f8cbf477 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 897f68cbca9..f71c448bffb 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.9.8} -\def\jsonparsefiledate{30 November 2024} +\def\jsonparsefileversion{0.9.9} +\def\jsonparsefiledate{1 December 2024} \usepackage[T1]{fontenc} \usepackage{Alegreya} @@ -339,7 +339,7 @@ For example, if the JSON string \macro{{ "key" : "value" }} has been parsed into \begin{macrodef} |\JSONParseSetValue|{<token variable>}{<token variable>}{<key>} \end{macrodef} -The expandable command \macro{\JSONParseValueSet} can be used to a select a value from the token variable that stores the parsed JSON data via a key and store this value in another token variable. +The command \macro{\JSONParseValueSet} can be used to a select a value from the token variable that stores the parsed JSON data via a key and store this value globally in another token variable. The first argument denotes the token variable where the value should be stored into. If this token variable has not yet been defined, it will be created by this command. The second argument represents the token variable (property list) that has been created using the commands \macro{\JSONParse} or \macro{\JSONParseFromFile} and that stores the parsed JSON data. The third argument takes the key to select the relevant value. @@ -348,7 +348,7 @@ The token list returned by this command is a string variable where all character \begin{macrodef} |\JSONParseSetRescanValue|{<token variable>}{<token variable>}{<key>} \end{macrodef} -The expandable command \macro{\JSONParseSetRescanValue} works the same way and also takes the same arguments as \macro{\JSONParseSetValue} except that it rescans the return value before storing it in the token variable. This means that the value stored in the token list will have the category codes TeX uses per default. +The command \macro{\JSONParseSetRescanValue} works the same way and also takes the same arguments as \macro{\JSONParseSetValue} except that it rescans the return value before storing it globally in the token variable. This means that the value stored in the token list will have the category codes TeX uses per default. This can, for example, be necessary when numbers stored in the JSON data in scientific format should be formatted using the \macro{siunitx} package. The rescan is needed here, because otherwise the character \macro{e} would have the wrong category code and would hence not be recognised by the formatting parser as exponent marker. Let us assume the key \macro{number} in some JSON source parsed into the token variable \macro{\myJSONnumber} represents the value \macro{-1.1e-1}, then the following could be used to format the output: diff --git a/Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty b/Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty index a8e21835b46..23b4a5b5e02 100644 --- a/Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty +++ b/Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty @@ -10,7 +10,7 @@ % % This work has the LPPL maintenance status `maintained'. % -\ProvidesExplPackage {jsonparse} {2024-11-30} {0.9.8} +\ProvidesExplPackage {jsonparse} {2024-12-01} {0.9.9} {A handy way to parse, store and access JSON data from files or strings in LaTeX documents} \bool_new:N \l__jsonparse_debug_mode_bool @@ -237,7 +237,7 @@ \cs_generate_variant:Nn \file_input:n { e } \cs_generate_variant:Nn \tl_gset:Nn { Ne , ce } -\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nne } +\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno , Nne } \cs_generate_variant:Nn \tl_range:nnn { nne , nen } \cs_generate_variant:Nn \tl_range:Nnn { Nne , Nen } \cs_generate_variant:Nn \tl_remove_once:Nn { NV } @@ -955,61 +955,73 @@ \symbol{ " \str_uppercase:n { #1 #2 #3 #4 } } { } } +\cs_new:Npn \__jsonparse_rescan_setup:Nn #1#2 { + \cs_set:Npn \" { " } + \cs_set:Npn \/ { / } + \cs_set:Npn \\ { \c_backslash_str } + \cs_set:Npn \b { \l__jsonparse_backspace_str } + \cs_set:Npn \f { \l__jsonparse_formfeed_str } + \cs_set:Npn \n { \l__jsonparse_linefeed_str } + \cs_set:Npn \r { \l__jsonparse_carriage_return_str } + \cs_set:Npn \t { \l__jsonparse_horizontal_tab_str } + \cs_set_eq:NN \u \__jsonparse_unicode_char:NNNN + \tl_set:Ne #1 {#2} + \cs_set_eq:NN \" \__jsonparse_tex_quote: + \cs_set_eq:NN \\ \__jsonparse_tex_backslash: + \bool_if:NT \l__jsonparse_escape_number_sign_bool { + \tl_replace_all:Noe #1 { \c_hash_str } { \c_backslash_str \c_hash_str } + } + \bool_if:NT \l__jsonparse_escape_dollar_sign_bool { + \tl_replace_all:Noe #1 { \c_dollar_str } { \c_backslash_str \c_dollar_str } + } + \bool_if:NT \l__jsonparse_escape_percent_sign_bool { + \tl_replace_all:Noe #1 { \c_percent_str } { \c_backslash_str \c_percent_str } + } + \bool_if:NT \l__jsonparse_escape_ampersand_bool { + \tl_replace_all:Noe #1 { \c_ampersand_str } { \c_backslash_str \c_ampersand_str } + } + \bool_if:NT \l__jsonparse_escape_circumflex_accent_bool { + \tl_replace_all:Non #1 { \c_circumflex_str } { \textasciicircum } + } + \bool_if:NT \l__jsonparse_escape_low_line_bool { + \tl_replace_all:Noe #1 { \c_underscore_str } { \c_backslash_str \c_underscore_str } + } + \bool_if:NT \l__jsonparse_escape_tilde_bool { + \tl_replace_all:Non #1 { \c_tilde_str } { \textasciitilde } + } +} + \cs_new:Npn \__jsonparse_rescan:n #1 { \group_begin: - \cs_set:Npn \" { " } - \cs_set:Npn \/ { / } - \cs_set:Npn \\ { \c_backslash_str } - \cs_set:Npn \b { \l__jsonparse_backspace_str } - \cs_set:Npn \f { \l__jsonparse_formfeed_str } - \cs_set:Npn \n { \l__jsonparse_linefeed_str } - \cs_set:Npn \r { \l__jsonparse_carriage_return_str } - \cs_set:Npn \t { \l__jsonparse_horizontal_tab_str } - \cs_set_eq:NN \u \__jsonparse_unicode_char:NNNN - \tl_set:Ne \l__jsonparse_temp_tl {#1} - \cs_set_eq:NN \" \__jsonparse_tex_quote: - \cs_set_eq:NN \\ \__jsonparse_tex_backslash: - \bool_if:NT \l__jsonparse_escape_number_sign_bool { - \tl_replace_all:Noe \l__jsonparse_temp_tl { \c_hash_str } { \c_backslash_str \c_hash_str } - } - \bool_if:NT \l__jsonparse_escape_dollar_sign_bool { - \tl_replace_all:Noe \l__jsonparse_temp_tl { \c_dollar_str } { \c_backslash_str \c_dollar_str } - } - \bool_if:NT \l__jsonparse_escape_percent_sign_bool { - \tl_replace_all:Noe \l__jsonparse_temp_tl { \c_percent_str } { \c_backslash_str \c_percent_str } - } - \bool_if:NT \l__jsonparse_escape_ampersand_bool { - \tl_replace_all:Noe \l__jsonparse_temp_tl { \c_ampersand_str } { \c_backslash_str \c_ampersand_str } - } - \bool_if:NT \l__jsonparse_escape_circumflex_accent_bool { - \tl_replace_all:Non \l__jsonparse_temp_tl { \c_circumflex_str } { \textasciicircum } - } - \bool_if:NT \l__jsonparse_escape_low_line_bool { - \tl_replace_all:Noe \l__jsonparse_temp_tl { \c_underscore_str } { \c_backslash_str \c_underscore_str } - } - \bool_if:NT \l__jsonparse_escape_tilde_bool { - \tl_replace_all:Non \l__jsonparse_temp_tl { \c_tilde_str } { \textasciitilde } - } + \__jsonparse_rescan_setup:Nn \l__jsonparse_temp_tl {#1} \tl_rescan:no { } { \l__jsonparse_temp_tl } \group_end: } +\cs_new:Npn \__jsonparse_gset_rescan:Nn #1#2 { + \group_begin: + \__jsonparse_rescan_setup:Nn \l__jsonparse_temp_tl {#2} + \tl_gset_rescan:Nno #1 { } { \l__jsonparse_temp_tl } + \group_end: +} +\cs_generate_variant:Nn \__jsonparse_gset_rescan:Nn { Ne } + \NewExpandableDocumentCommand { \JSONParseExpandableValue } { m m } { \prop_item:Ne #1 {#2} } -\NewExpandableDocumentCommand { \JSONParseSetValue } { m m m } { +\NewDocumentCommand { \JSONParseSetValue } { m m m } { \tl_if_exist:NF #1 { \tl_new:N #1 } - \tl_set:Nne #1 { \prop_item:Ne #2 {#3} } + \tl_set:Ne #1 { \prop_item:Ne #2 {#3} } } -\NewExpandableDocumentCommand { \JSONParseSetRescanValue } { m m m } { +\NewDocumentCommand { \JSONParseSetRescanValue } { m m m } { \tl_if_exist:NF #1 { \tl_new:N #1 } - \tl_set_rescan:Nne #1 { } { \prop_item:Ne #2 {#3} } + \__jsonparse_gset_rescan:Ne #1 { \prop_item:Ne #2 {#3} } } \NewDocumentCommand { \JSONParseValue } { O{} m m } { |