Closed IanMayo closed 4 months ago
It'll be a little while before I can get to this Ian, sorry. Currently in the process of wiping my laptop and restoring a backup, something had gone very weird on my laptop (possibly a virus or some other malware?). Hopefully back up and running soon, will keep you updated.
That's completely fine @robintw , I was just capturing it.
Hmm, I've just been thinking about this, and it's going to be trickier than I originally thought. We currently process files as soon as we find a link to them (in Run 2) - and that link hasn't always come from the category page, it might have come from a general link from another page. If we come from another link not the link from the category page then we won't have the category page details to hand.
Of course, as always, writing this down to explain to you has helped me think about it more and I've come up with a potential solution. I think we'll need to gather this category page information in Run 1 and store it and then use it in Run 2 to populate the DITA.
I'll get to this as soon as I can, but it'll take a bit more time than I expected, and life is a bit chaotic right now.
Yes, "gather it in run-1" was on the tip of my tongue as I was reading that :-)
I did explore the code last week, and experimented with passing the data through, but process generic file
was called from multiple locations, and the first run typically wasn't from the code that was aware of the flag data.
When we are looking at a class file, it's easy to forget which nation this is for.
This is particularly significant if/when we are looking at a class with a name that is in use across multiple countries.
It would be useful to prepend the class page title with the country image (and maybe even the country name).
The title block for class files currently looks like this:![image](https://github.com/DeepBlueCLtd/LegacyMan/assets/1108513/96754811-0e8b-4f0d-a7f3-d091ff556533)
We can legitimately extend it to include the flag using this markup:![image](https://github.com/DeepBlueCLtd/LegacyMan/assets/1108513/81269cf0-64b9-48df-93e9-b8187264a6f4)
As we walk the tree, we should pass the URL for the country's flag image, plus the image dimensions to the
class
file - so that we can prepend the image. While we are doing this, we should probably also pass the country name through, for if/when we need to display the country name.Update: we should make the flag clickable, to go back to the country page. To support this we should also pass the URL for the country page.
Update 2: I've just been working in this code, and have these observations. The data is already passed to
process_category_pages
. I think we could add some params toprocess_generic_file
. If that method receives these params it will use them to generate a fancy header block.The DITA should be structured like this:![image](https://github.com/DeepBlueCLtd/LegacyMan/assets/1108513/306a5a37-46aa-4dcc-99b1-b0a0441fe57c)
Update 3: We do have a Special-Case. It's for the Non-Standard countries that start with an image table (
Britain
). These start with an image table, with links to standard category listings. For these, we need to capture/include the country flag in the non-standard country page (#650), and the pass that image/URL to the category listing page. The flag on the category listing page will then link back to the non-standard page. So,Britain
will have a flag/title which doesn't link to anything. The "complex/legacy.etc" images will link tobritain_legacy.html
- a category page. The flag image on this page will link back to theBritain
country page. For class pages that are on the category page, their flag link will also go back to the parentBritain
country page. For countries that have a standard category listing, the flag won't link to anything on the category page, but the class pages will link back to the standard categroy listing.