Skip to content

Commit

Permalink
Add new types and check that type exists in \@@_typecheck_lua_option:n
Browse files Browse the repository at this point in the history
The new types are `path` for pathnames and `slice` for slice specifiers.
Progresses #124.
  • Loading branch information
Witiko committed Jun 8, 2022
1 parent 87b8a40 commit 85ffde4
Showing 1 changed file with 51 additions and 20 deletions.
71 changes: 51 additions & 20 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -2002,7 +2002,7 @@ option.
\prop_put:Nnn
\g_@@_lua_option_types_prop
{ cacheDir }
{ string }
{ path }
\prop_put:Nnn
\g_@@_default_lua_options_prop
{ cacheDir }
Expand Down Expand Up @@ -2237,7 +2237,7 @@ the markdown document from “Hello *world*!” to “Hi *world*!” was not ref
\prop_put:Nnn
\g_@@_lua_option_types_prop
{ frozenCacheFileName }
{ string }
{ path }
\prop_put:Nnn
\g_@@_default_lua_options_prop
{ frozenCacheFileName }
Expand Down Expand Up @@ -3976,7 +3976,7 @@ following text:
\prop_put:Nnn
\g_@@_lua_option_types_prop
{ contentBlocksLanguageMap }
{ string }
{ path }
\prop_put:Nnn
\g_@@_default_lua_options_prop
{ contentBlocksLanguageMap }
Expand Down Expand Up @@ -6654,7 +6654,7 @@ following text:
\prop_put:Nnn
\g_@@_lua_option_types_prop
{ slice }
{ string }
{ slice }
\prop_put:Nnn
\g_@@_default_lua_options_prop
{ slice }
Expand Down Expand Up @@ -8302,7 +8302,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
\prop_put:Nnn
\g_@@_plain_tex_option_types_prop
{ helperScriptFileName }
{ string }
{ path }
\prop_put:Nnx
\g_@@_default_plain_tex_options_prop
{ helperScriptFileName }
Expand Down Expand Up @@ -8332,7 +8332,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
\prop_put:Nnn
\g_@@_plain_tex_option_types_prop
{ inputTempFileName }
{ string }
{ path }
\prop_put:Nnx
\g_@@_default_plain_tex_options_prop
{ inputTempFileName }
Expand Down Expand Up @@ -8362,7 +8362,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
\prop_put:Nnn
\g_@@_plain_tex_option_types_prop
{ outputTempFileName }
{ string }
{ path }
\prop_put:Nnx
\g_@@_default_plain_tex_options_prop
{ outputTempFileName }
Expand Down Expand Up @@ -8393,7 +8393,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
\prop_put:Nnn
\g_@@_plain_tex_option_types_prop
{ errorTempFileName }
{ string }
{ path }
\prop_put:Nnx
\g_@@_default_plain_tex_options_prop
{ errorTempFileName }
Expand Down Expand Up @@ -8428,7 +8428,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
\prop_put:Nnn
\g_@@_plain_tex_option_types_prop
{ outputDir }
{ string }
{ path }
\prop_put:Nnn
\g_@@_default_plain_tex_options_prop
{ outputDir }
Expand Down Expand Up @@ -8459,7 +8459,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
\prop_put:Nnn
\g_@@_plain_tex_option_types_prop
{ cacheDir }
{ string }
{ path }
\prop_put:Nnx
\g_@@_default_plain_tex_options_prop
{ cacheDir }
Expand Down Expand Up @@ -8495,7 +8495,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
\prop_put:Nnn
\g_@@_plain_tex_option_types_prop
{ frozenCacheFileName }
{ string }
{ path }
\prop_put:Nnx
\g_@@_default_plain_tex_options_prop
{ frozenCacheFileName }
Expand Down Expand Up @@ -21580,10 +21580,19 @@ end
% \begin{macrocode}
\ExplSyntaxOn
\tl_new:N \g_@@_formatted_lua_options_tl
\tl_const:Nn \c_@@_lua_option_type_boolean { boolean }
\tl_const:Nn \c_@@_lua_option_type_counter { counter }
\tl_const:Nn \c_@@_lua_option_type_number { number }
\tl_const:Nn \c_@@_lua_option_type_string { string }
\seq_new:N \g_@@_option_types_seq
\tl_const:Nn \c_@@_option_type_boolean { boolean }
\seq_put_right:NV \g_@@_option_types_seq \c_@@_option_type_boolean
\tl_const:Nn \c_@@_option_type_counter { counter }
\seq_put_right:NV \g_@@_option_types_seq \c_@@_option_type_counter
\tl_const:Nn \c_@@_option_type_number { number }
\seq_put_right:NV \g_@@_option_types_seq \c_@@_option_type_number
\tl_const:Nn \c_@@_option_type_path { path }
\seq_put_right:NV \g_@@_option_types_seq \c_@@_option_type_path
\tl_const:Nn \c_@@_option_type_slice { slice }
\seq_put_right:NV \g_@@_option_types_seq \c_@@_option_type_slice
\tl_const:Nn \c_@@_option_type_string { string }
\seq_put_right:NV \g_@@_option_types_seq \c_@@_option_type_string
\cs_new:Nn \@@_format_lua_options:
{
\tl_gclear:N
Expand Down Expand Up @@ -21617,23 +21626,29 @@ end
\tl_case:NnF
\l_tmpb_tl
{
\c_@@_lua_option_type_string
\c_@@_option_type_boolean
{
\tl_gput_right:Nx
\g_@@_formatted_lua_options_tl
{ #1~=~ \cs:w \l_tmpa_tl \cs_end: ,~ }
}
\c_@@_option_type_number
{
\tl_gput_right:Nx
\g_@@_formatted_lua_options_tl
{ #1~=~" \cs:w \l_tmpa_tl \cs_end: ",~ }
{ #1~=~ \cs:w \l_tmpa_tl \cs_end: ,~ }
}
\c_@@_lua_option_type_counter
\c_@@_option_type_counter
{
\tl_gput_right:Nx
\g_@@_formatted_lua_options_tl
{ #1~=~ \the \cs:w \l_tmpa_tl \cs_end: ,~ }
{ #1~=~ \the \cs:w \l_tmpa_tl \cs_end: ,~ }
}
}
{
\tl_gput_right:Nx
\g_@@_formatted_lua_options_tl
{ #1~=~ \cs:w \l_tmpa_tl \cs_end: ,~ }
{ #1~=~" \cs:w \l_tmpa_tl \cs_end: ",~ }
}
}
}
Expand All @@ -21643,6 +21658,12 @@ end
{
Lua~option~#1~is~undefined.
}
\msg_new:nnn
{ markdown }
{ unknown-lua-option-type }
{
Lua~option~#1~has~unknown~type~#2.
}
\msg_new:nnn
{ markdown }
{ failed-typecheck-for-boolean-lua-option }
Expand All @@ -21668,6 +21689,16 @@ end
{ #1 }
\l_tmpb_tl
{
\seq_if_in:NVF
\g_@@_option_types_seq
\l_tmpb_tl
{
\msg_error:nnxx
{ markdown }
{ unknown-lua-option-type }
{ #1 }
{ \l_tmpb_tl }
}
\cs_if_free:cTF
{ \l_tmpa_tl }
{ }
Expand Down

0 comments on commit 85ffde4

Please sign in to comment.