Grab just the main content of a MediaWiki page #10950
Closed
plittlefield
started this conversation in
General
Replies: 3 comments 1 reply
-
Could you please provide a complete minimal example of what you are trying to do? |
Beta Was this translation helpful? Give feedback.
0 replies
-
If you want to discard all document content except for the content of a single div with a unique identifier or class you can use a Lua filter like this: local div_content
local get_div = function(div)
if 'my-id' == div.identifier then
div_content = div.content
end
-- if div.classes:includes('my-class') then
-- div_content = div.content
-- end
return nil
end
local set_body = function(doc)
if div_content then
doc.blocks = div_content
return doc
end
return nil
end
return {
{ Div = get_div },
{ Pandoc = set_body }
} For example with this input ::: {#outer}
Start of outer.
::: {#my-id}
Div content
::: inner
Inner content
:::
:::
End of outer
::: with this commandline pandoc -w markdown div2doc.lua example.md you get Div content
::: inner
Inner content
::: |
Beta Was this translation helpful? Give feedback.
1 reply
-
I’ll try these suggestions and also htmlq cheers! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to grab just the 'main content' part of a MediaWiki page?
It comes after these sections (taken from the Markdown version) ...
So, I guess I want to grab what comes out in the "Printable Version" of a page - without the theme or any styling.
Thanks in advance.
Paully
Beta Was this translation helpful? Give feedback.
All reactions