DeepBlueCLtd / LegacyMan

Legacy content for Field Service Manual
https://deepbluecltd.github.io/LegacyMan/index.html
Apache License 2.0
2 stars 0 forks source link

Propagate flag (and dimensions) through to class files #640

Closed IanMayo closed 4 months ago

IanMayo commented 6 months ago

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

We can legitimately extend it to include the flag using this markup: image

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 to process_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

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 to britain_legacy.html - a category page. The flag image on this page will link back to the Britain country page. For class pages that are on the category page, their flag link will also go back to the parent Britain 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.

robintw commented 6 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.

IanMayo commented 6 months ago

That's completely fine @robintw , I was just capturing it.

robintw commented 6 months ago

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.

IanMayo commented 6 months ago

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.