This is a work-in-progress proof-of-concept to show how we might provide some script to replace some tags on Bricks.stackexchange.com with pictures sourced from LUGNet Parts Guide.
When it's complete, the aim is that you would be able to take a reference to the BrickJax script and then where ever it finds matching tags, it replaces them with an image.
Simple proof of concept call:
To reduce calls and roundtrips, if the request results in an image, the returned object contains the Alt Text and the image data that can be added directly to an <img src="[data.Src]" alt="[data.AltText]" /> element.
The JSON object returned contains the following properties:
The following should not be replaced because it is inside a <code> element:
[part:6260c01:21] [bs:5509] [bl:5509]
These codes should be replaced by images:
[PART:3001:14] [parT:2337] [part:777p06] [part:6260c01:21] [part:884]
PartLink examples: [Partlink:2552], [partlink:32181c02:0]
Example of broken code: [pARt:3712c01:7] (code should work, but LUGNET Partsref is out of date vs LDRAW)
Example of broken image on link: [pARtlink:3712c01:7]