"Regarding your closing remark about character entities for the non-ASCII characters, I think one rule will suffice: use HTML::Entities. ..."
Use of HTML::Entities was my first thought too; however, the one line that didn't follow the general pattern seemed so different, that I decided to suggest special rules or manual editing.
For all lines (except the que_esta_pasando.png one), the "my @name = ..." line seemed to embody the general pattern to the extent possible from the code provided by the OP: trapped.png becomes Trapped, the_look.png becomes The Look, and so on.
For the que_esta_pasando.png line, the general pattern is not applied beyond splitting on underscores.
I think your "Update" alludes to this but I thought I'd point out the differences, as I see them, in this specific case.
-
Split on underscores (as for other lines): "que_esta_pasando.png" becomes "que esta pasando"
-
Know this is a foreign language. [I've assumed Spanish; happy to be corrected; it doesn't change the point I'm making.]
-
Apply the appropriate diacritical marks for this language: "que esta pasando" becomes "qué está pasando"
-
Treat as a sentence, not as a title, so only the first word is capitalised: "qué está pasando" becomes "Qué está pasando"
-
Know enough of this language to understand that this sentence is a question, not a statement. Apply the appropriate punctuation for a question in this language: "Qué está pasando" becomes "¿Qué está pasando?"
-
Not shown, but adding a lang="es" attribute would probably also be appropriate.
All of this could be coded and, for some massive international image library with ongoing maintenance requirements, may well be the way to go.
However, the OP states "I'm working in a basic html page, actually it is just a list of links to some pictures.": in this instance, rules (such as a lookup table which you've suggested) or manual editing seems more sensible and a lot less work.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.