moratnz / makepdfbook Goto Github PK
View Code? Open in Web Editor NEWAn extension for MediaWiki to produce a PDF book from a category.
An extension for MediaWiki to produce a PDF book from a category.
So we can close the div in the chapterinfo template and still have the styling work
Hopefully these can be included as transcluded pages
e.g., group all the 'conventions - ' sections together
There's big wacks of javascript that MakePdfBook uses that's being manually copied into MediaWiki:Common.js in installs we're using MakePdfBook in.
That's dumb, It should be included as a resource in MakePdfBook.
Refactor things to use getBooks() rather than making lots of separate DB calls
It's currently alphabetical
These are currently global variables being set in LocalSettings.
They should be config items being set in extension.json.
Move them, and clean up references to them
Need to account for US letter and A4
Links in the pdf are rendering as relative links (as they should within the wiki), which breaks in a pdf.
For links that are internal to the pdf, it'd be great to work out how to get them to render as actual internal pdf links. For links that are actually external to the pdf, they should be prefixed with the wiki host name.
And the handbook page shouldn't be included in the chapter set that's sent to things like the pdf generator.
options include giving the handbook page a magic sort key, e.g., 'handbook', or 'contents', or move the stuff that's currently held on the handbook page into the category page.
As part of the work to automate the navigation sidebar in use in the wikis using this extension, it would be useful to be able to hand the font end a json object describing the handbooks in the wiki and their contents.
An example of the desired data structure:
[
{
namespace: "Armored_Combat",
label: "Armored Combat",
webVersion: "/index.php/Armored_Combat:Handbook",
pdfVersion: "/index.php/Special:MakePdfBook?category=Armored_Combat_Handbook",
chapters: [
[
"Introduction",
"/index.php/Armored_Combat:Introduction"
],
[
"Change Log",
"/index.php/Armored_Combat:Change_Log"
],
[
"1. Combat Authorization Requirements",
"/index.php/Armored_Combat:Combat_Authorization_Requirements"
],
[
"2. Rules of the Lists",
"/index.php/Armored_Combat:Rules_Of_The_Lists"
],
[
"3. Conventions of Combat",
"/index.php/Armored_Combat:Conventions_Of_Combat"
],
[
"4. The Use of Weapons and Shields",
"/index.php/Armored_Combat:Use_Of_Weapons_And_Shields"
],
[
"5. Acknowledgement of Blows",
"/index.php/Armored_Combat:Acknowledgement_Of_Blows"
],
[
"6. Armour Requirements",
"/index.php/Armored_Combat:Armor_Requirements"
],
[
"7. Weapon Standards",
"/index.php/Armored_Combat:Weapons_Standards"
],
[
"8. Siege Combat",
"/index.php/Armored_Combat:Siege_Combat"
],
[
"9. Authorization of Marshals",
"/index.php/Armored_Combat:Procedures_For_The_Authorization_Of_Marshals"
],
[
"10. Marshaling Wars",
"/index.php/Armored_Combat:Procedures_For_Marshaling_Wars"
],
[
"11. Marshaling Requirements",
"/index.php/Armored_Combat:Marshaling_Requirements"
],
[
"12. Combat Injury Procedures",
"/index.php/Armored_Combat:Combat_Injury_Procedures"
],
[
"13. Marshaling on the Field",
"/index.php/Armored_Combat:Guidelines_For_Marshaling_On_The_Field"
],
[
"14. Combat Authorization Procedures",
"/index.php/Armored_Combat:Combat_Authorization_Procedures"
],
[
"15. Equipment Inspection Guidelines",
"/index.php/Armored_Combat:Equipment_Inspection_Guidelines"
],
[
"16. Experimental Weapons and Materials",
"/index.php/Armored_Combat:Experimental_Weapons_And_Materials_Procedures"
],
[
"17. Marshal Responsibilities, Chain of Command, and Reporting",
"/index.php/Armored_Combat:Marshal_Responsibilities_Chain_Of_Command_And_Reporting"
],
[
"18. Grievances and Sanctions",
"/index.php/Armored_Combat:Procedures_For_Grievances_And_Sanctions"
],
[
"Glossary",
"/index.php/Armored_Combat:Glossary"
]
]
}
]
The namespace bits included in MakePdfBook are potentially of wider interest than the pdf generation bits.
Look at spinning them off into their own extension and publishing it
Will use H1 headings as Chapter titles instead (can remove {{DISPLAYTITLE:}} which is tripping security stuff in Lochac live)
In testing I've observed:
The difference between these is that the latter has an additional WHERE statement in its DB call; that's about it.
For the moment I'm sidestepping this issue by doing all content loading with BookSet->fetch..., but it'd be nice to sort this so content can be loaded in a more targeted fashion.
Add title page creation links to the output of generateCategoryListPage, such that if a title page for category foo
isn't found, a redlink for foo_titlepage?create
is inserted in the table there
Feature addition:
Add option to render
command to create an archive copy of the current pdf
The archive should be named something like <category_name>-<tag>.pdf
where tag
is either a date or version number.
It should be stored into the appropriate place in the file tree, and registered appropriately in the DB.
Parameters:
generateArchive=tag
: here the specified tag
gets put into the archive file.
Stretch goal:
Add dynamic pages to show all the historical versions of the handbooks.
We're currently applying inline styles to the pdf icons to avoid the delightfully named FOUT (flash of unsettled text).
This is somewhat filthy.
The correct solution is probably to include an appropriately licensed SVG in the extension images.
To avoid draft content from being indexed by google, we should implement 'noindex' meta tags on all draft pages.
This should be a very short hook that can be attached anywhere we have access to the Output object with $out->addMeta()
The result meta tag we're after is:
<meta name="robots" content="noindex, nofollow" />.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.