Forgive my ignorance as I am a complete newbie to Perl. And my desired task I'm afraid takes theskills of a master. So I humbly present my problem here in hopes that one of the many masters will help a new initiate. Thanks in advance.
I need to loop through a large html file, find usage of umlauted characters in a specific tag, copy and alter the tag by substituting a unicode character with two new characters, and append that tag next to the original tag. I feel like I can use Perlre to find the pattern, and then the tag will have to be copied, altered, and placed correctly next to the new tag.
1. The script must copy a tag and replace the umlauted letter with a oe,ue, or ae and append this to the same location below is two examples.
<idx:orth value="aufhören"/> <idx:orth value="Förderverein"/>
What we need is two tags like this:
<idx:orth value="aufhören"/><idx:orth value="aufhoeren"/>or
<idx:orth value="Förderverein"/><idx:orth value="Foerderverein"/>2. The case of the headword should be retained. If it is capitalized then the new tag should also be capitalized. An example is presented above and below.
<idx:orth value="Öl"/><idx:orth value="Oel">The script will have to identify every use of an umlaut in this tag set, copy the tag, and write it next to the original tag with the spelling change.
Below is an example of the full entry:
<idx:entry name="dic" scriptable="yes" wild="yes" spell="yes"><idx:sho +rt><div height="4"><a name="51707"/><div><idx:orth value="Förderverein"/><b>F</b><font color +="#000000"><betonung/><b><b>ö</b></b></font><b>r</b>·<b>der</b>·<b>ve +r</b>·<b>ein, </b>der: </div><blockquote>zur <a href="#51698"><font s +ize="+1"><b><img hspace="0" align="middle" hisrc="bbm/t2i-ie/U8593.1NI48A-h.gif"/></b></font> Förderung (1)</a> e +iner bestimmten Sache gegründeter Verein.</blockquote></div></idx:sho +rt></idx:entry><div height="10" align="center"><img hspace="0" vspace +="0" align="middle" losrc="bbm/rectangle-php/150-1-U35555555-l.gif" h +isrc="bbm/rectangle-php/520-4-U35555555-h.gif" src="bbm/rectangle-php +/200-1-U35555555-m.gif"/><br/></div>
A corrected version of the html would look like this:
<idx:entry name="dic" scriptable="yes" wild="yes" spell="yes"><idx:sho +rt><div height="4"><a name="51707"/><div><idx:orth value="Förderverei +n"/><idx:orth value="Foerderverein"/><b>F</b><font color="#000000"><b +etonung/><b><b>ö</b></b></font><b>r</b>·<b>der</b>·<b>ver</b>·<b>ein, + </b>der: </div><blockquote>zur <a href="#51698"><font size="+1"><b>< +img hspace="0" align="middle" hisrc="bbm/t2i-ie/U8593.1NI48A-h.gif"/></b></font> Förderung (1)</a> e +iner bestimmten Sache gegründeter Verein.</blockquote></div></idx:sho +rt></idx:entry><div height="10" align="center"><img hspace="0" vspace +="0" align="middle" losrc="bbm/rectangle-php/150-1-U35555555-l.gif" h +isrc="bbm/rectangle-php/520-4-U35555555-h.gif" src="bbm/rectangle-php +/200-1-U35555555-m.gif"/><br/></div>
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |