#StackBounty: #errors #luatex #footnotes #compiling #expl3 How correct do auto tagging of page break

Bounty: 150

In our package i want handle page break,to use tagpdf package in genericnode. For this i want to redefine tagncbegin/tagncend commands, to save last params of tagging. For this i save this params in tallest,but when i redefine naketitle command,i get an error:

            inaccessible 

l.73 maketitle
Also i have a problem with converting of tlist to keys,because according to documentation, in l3keys arguments consider as strings, so name of variables in arguments will consider as string value,but not as name of variable,which should be expanded. Help me please solve this problems. Thanks everybody very much for any help (i use the latest version of tagpdf and pdfresources packages from newest )branches on GitHub and sorry for line separators,because i modified and write now my post from my Mac).

RequirePackage[patches]{pdfresources}
DeclareDocumentMetadata{pdfversion=2.0}
documentclass{article}
usepackage{tagpdf}
tagpdfsetup{tabsorder=structure,uncompress,activate-all,add-new-tag=Title/P,interwordspace=true}
ExplSyntaxOn
makeatletter
  tl_new:N g__last_mc_tl %last opened mc tag with all params
  bool_new:N g__inside_new_page_command_bool
letorig@tagmcbegin=tagmcbegin
  letorig@tagmcend=tagmcend
letorig@newpage=newpage
renewcommand{tagmcbegin}[1]{
tl_gset:Nn  g__last_mc_tl{#1}
orig@tagmcbegin{#1}
}
renewcommand{tagmcend}{
orig@tagmcend
bool_if:NTF g__inside_new_page_command_bool{}{tl_gclear:N g__last_mc_tl}
}
  renewcommand{newpage}{
  tl_if_empty:NTF g__last_mc_tl{
  orig@newpage
}{
bool_gset_true:N g__inside_new_page_command_bool
tagmcend
bool_gset_false:N g__inside_new_page_command_bool
orig@newpage
tagmcbegin{g__last_mc_tl}
}}
%tagging of title

prop_set_from_keyval:Nn l__kozlovskiy_data_of_title_prop
  {
    @author = H1 ,
    @date   = H1 ,
    @title  = H1 ,
  }
DeclareRobustCommandthanks[1]{footnotemark
    protected@xdef@thanks{@thanks
        protectfootnotetext[thec@footnote]{tagstructbegin{tag=H1}tagmcbegin{tag=H1}#1tagmcendtagstructend}}
}
cs_new_protected:Npn kozlovskiy_maketitle:
  {
    tagstructbegin{tag=Title}
prop_map_inline:Nn l__kozlovskiy_data_of_title_prop{
cs_set_eq:cc { orig@##1 } { ##1 }
bool_if:nTF{tl_if_empty_p:N {##1}}
{
use:c { orig@##1 }
}
{
cs_gset_protected:cpn { ##1 } {
tagstructbegin{tag=##2}
tagmcbegin{tag=##2}
use:c { orig@##1 } 
tagmcend
tagstructend
}
}
}
__kozlovskiy_original_maketitle:
    tagstructend
  }
cs_new_eq:NN __kozlovskiy_original_maketitle: maketitle
cs_gset_protected:Npn maketitle { kozlovskiy_maketitle: }
makeatother
ExplSyntaxOff
begin{document}
tagstructbegin{tag=Document}
author{Alexandr Kozlovskiy}
title{test thanks{Alexandr Kozlovskiy}}
maketitle{}
tagstructbegin{tag=P}
tagmcbegin{tag=P}
Test
newpage
test again
tagmcend
tagstructend
tagstructend
end{document}


Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.