in reply to Moving a tag within text with XML::Twig
As for cases where the following sibling has no text (note: there are "prev_sibling()" and "next_sibling()" methods for elt objects), it may be a matter of understanding your document structure to determine whether you need to insert a new elt as a next sibling in order to move the punctuation text into that, or whether you can just assign text content (the punctuation) to the next sibling, whatever it may be.for ( grep { $_->prev_sibling_text =~ m<([,.])\s*$> } @foots ) { ...
(I suspect that inserting a new elt as the next sibling will be the way to go -- it covers both cases of "no next sibling" and "next sibling has no text". Or maybe you should review the "local typographical rules" to see if maybe the footnote does not need to be placed before punctuation when no text follows. Frankly, I think the "rule" you stated is suspect -- having footnotes after punctuation seems like a common practice.)
In any case, are you sure that looking just for final period or comma is sufficient? What about question/exclamation marks, quotation marks, parens, and any combination thereof?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Moving a tag within text with XML::Twig
by skillet-thief (Friar) on Sep 25, 2005 at 18:06 UTC |