On Sun, Jun 5, 2011 at 6:22 PM, Platonides <Platonides(a)gmail.com> wrote:
If the user has a stub threshold different than 0,
SELECT
page_namespace,page_title FROM pagelinks JOIN page ON ... WHERE
pl_from=$this->mArticleId AND page_len < $user->getStubThreshold();
For each of those stub pages: $a = Linker::Link() (ignoring stub
threshold), $b = Linker::Link() (as stub).
Extract the open tag from $a and $b.
str_replace $a with $b in the html.
Bypassing the whole parsing structure in that way is not pretty, but
it's really efficient.
Hmm, interesting approach. Basically a postprocessor like I was
thinking of, except simpler. I was thinking you'd insert special
markers into the HTML that you'd replace later. But I can't think of
any ways you'd get mismatches with your method, given that the parser
outputs reasonably simple HTML -- in particular, no comments or
<script>s or <style>s or other things where you can have unescaped <'s
as text.