texlive[73010] Master/texmf-dist: jsonparse (1dec24)

commits+karl at tug.org commits+karl at tug.org
Sun Dec 1 22:05:18 CET 2024


Revision: 73010
          https://tug.org/svn/texlive?view=revision&revision=73010
Author:   karl
Date:     2024-12-01 22:05:17 +0100 (Sun, 01 Dec 2024)
Log Message:
-----------
jsonparse (1dec24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/jsonparse/README.md
    trunk/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.pdf
    trunk/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex
    trunk/Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty

Modified: trunk/Master/texmf-dist/doc/latex/jsonparse/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/jsonparse/README.md	2024-12-01 17:52:26 UTC (rev 73009)
+++ trunk/Master/texmf-dist/doc/latex/jsonparse/README.md	2024-12-01 21:05:17 UTC (rev 73010)
@@ -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)
 

Modified: trunk/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex	2024-12-01 17:52:26 UTC (rev 73009)
+++ trunk/Master/texmf-dist/doc/latex/jsonparse/jsonparse-doc.tex	2024-12-01 21:05:17 UTC (rev 73010)
@@ -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 @@
 \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 @@
 \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:
 

Modified: trunk/Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty	2024-12-01 17:52:26 UTC (rev 73009)
+++ trunk/Master/texmf-dist/tex/latex/jsonparse/jsonparse.sty	2024-12-01 21:05:17 UTC (rev 73010)
@@ -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 } {



More information about the tex-live-commits mailing list.