-
I’m writing a Lua filter, where I use the Figure function to change the figure appearance if it has a given class. But I also would like to change appearance of the previous element in the AST if it’s a header. How can I achieve that? And, reversely, if I select a header if it has a certain class, can I modify the next element in the AST if it’s a figure? Excerpt of my AST: , Header 2 ( "section" , [ "plain" ] , [] ) []
, Figure
( "" , [] , [] )
(Caption
Nothing
[ Plain
[ Str "Le"
, Space
, Str "petit"
, Space
, Str "\226ne"
, Space
, Str "gris"
]
])
[ Plain
[ Image
( "" , [ "fullframegraphicnoadjust" ] , [] )
[ Str "Le"
, Space
, Str "petit"
, Space
, Str "\226ne"
, Space
, Str "gris"
]
( "images/somepicture.png" , "" )
]
] Thanks for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
In this precise case, it is possible, if you hierarchicalize the doc using In the first problem, let's say the target Figure class is
If so, then modify the first Block of the Div, which by construction must be the Header associated with the section. In the second problem, let's say the target Header class is
If so, then modify that second Block. After this, you can undo the Of course, by "ask the question" above, I mean a well-crafted filter.
|
Beta Was this translation helpful? Give feedback.
-
You may search that combination of Header+Figure with Blocks. |
Beta Was this translation helpful? Give feedback.
You may search that combination of Header+Figure with Blocks.