Re: [Trac] patch to run IncludeMacro with Trac 1.6

Jun Omae <[email protected]> Thu, 2 Oct 2025 16:22:40 +0900
Newsgroups gmane.comp.version-control.subversion.trac.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------eZF3XKbP2yGH95La1r0CI4xK
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks for the another patch.
Also, I noticed the same issue raises when source: resource is given.

Fixed it in https://trac-hacks.org/changeset/18709.

On 2025/09/27 18:05, Ales Horak wrote:
> Thank you.
>
> Another small patch attached that I needed for including an HTML page wit=
h UTF-8 encoding as `Include(http://www.example.com/page.html)` .
> Without decoding, the page is included as bytes with all special characte=
rs escaped.
> It might be better to enter the encoding as a parameter.
> --
> ales horak
>
>
> Dne st=C5=99eda 17. z=C3=A1=C5=99=C3=AD 2025=C2=A0v=C2=A04:13:15 UTC+2 u=
=C5=BEivatel Jun Omae napsal:
>
>     Thanks for the feedback.
>     I've committed the patch in=C2=A0[18706] <https://trac-hacks.org/chan=
geset/18706>.
>
>     On 2025/09/14 16:27, Ale=C5=A1 Hor=C3=A1k wrote:
>>     Hi,
>>
>>     thank you. my patch was the minimum to get it to work, just fixing t=
he errors that appeared :-)
>>
>>     yours is more complete and functional=C2=A0=F0=9F=91=8D
>>
>>     --=20
>>     ales horak
>>
>>
>>     --=20
>>     Ale=C5=A1 Hor=C3=A1k
>>
>>
>>     ne 14. 9. 2025 v=C2=A05:53 odes=C3=ADlatel Jun Omae <[email protected]=
m> napsal:
>>
>>         Hi,
>>
>>         On Sat, Sep 13, 2025 at 04:13:16AM -0700, Ales Horak wrote:
>>         > current https://trac-hacks.org/wiki/IncludeMacro does not run =
under Trac 1.6
>>         > due to genshi imports
>>         >
>>         > see the attached patch to make it functional
>>         >
>>         > --=C2=A0
>>         > ales horak
>>
>>         Thanks for the patch! However, it seems to be incomplete.
>>
>>         $ pyflakes includemacro/macros.py
>>         includemacro/macros.py:214:59: undefined name 'TracHTMLSanitizer=
'
>>         includemacro/macros.py:244:23: undefined name 'ParseError'
>>         includemacro/macros.py:255:27: undefined name 'ParseError'
>>         includemacro/macros.py:288:20: undefined name 'ParseError'
>>
>>         Could you please try the attached patch?
>>
>>         --=20
>>         You received this message because you are subscribed to a topic =
in the Google Groups "Trac Users" group.
>>         To unsubscribe from this topic, visit https://groups.google.com/=
d/topic/trac-users/oIX9bq6TkVc/unsubscribe.
>>         To unsubscribe from this group and all its topics, send an email=
 to trac-users+...-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
>>         To view this discussion visit https://groups.google.com/d/msgid/=
trac-users/aMY8Eia7Pi0d/sOV%40localhost.
>>
>>     --=20
>>     You received this message because you are subscribed to the Google G=
roups "Trac Users" group.
>>     To unsubscribe from this group and stop receiving emails from it, se=
nd an email to trac-users+...-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
>>     To view this discussion visit https://groups.google.com/d/msgid/trac=
-users/CAHm62qP8EwaOVoCpjNiTBThhNNLAs6%2BGGrU6nznXEoX6AOPw7A%40mail.gmail.c=
om <https://groups.google.com/d/msgid/trac-users/CAHm62qP8EwaOVoCpjNiTBThhN=
NLAs6%2BGGrU6nznXEoX6AOPw7A%40mail.gmail.com?utm_medium=3Demail&utm_source=
=3Dfooter>.
>
>
>     -- Jun Omae <[email protected]> (=E5=A4=A7=E5=89=8D =E6=BD=A4)
>
> --=20
> You received this message because you are subscribed to the Google Groups=
 "Trac Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an=
 email to trac-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
> To view this discussion visit https://groups.google.com/d/msgid/trac-user=
s/99108147-9d89-4159-b467-43257e803ec4n%40googlegroups.com <https://groups.=
google.com/d/msgid/trac-users/99108147-9d89-4159-b467-43257e803ec4n%40googl=
egroups.com?utm_medium=3Demail&utm_source=3Dfooter>.


--=20
Jun Omae <[email protected]> (=E5=A4=A7=E5=89=8D =E6=BD=A4)

--=20
You received this message because you are subscribed to the Google Groups "=
Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to trac-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To view this discussion visit https://groups.google.com/d/msgid/trac-users/=
f8797b19-bf9f-4f06-abbd-e4c763be9272%40gmail.com.

--------------eZF3XKbP2yGH95La1r0CI4xK
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-8=
">
  </head>
  <body>
    <div class=3D"moz-cite-prefix">Thanks for the another patch.</div>
    <div class=3D"moz-cite-prefix">Also, I noticed the same issue raises
      when source: resource is given.</div>
    <div class=3D"moz-cite-prefix"><br>
    </div>
    <div class=3D"moz-cite-prefix">Fixed it in <a moz-do-not-send=3D"true"
        href=3D"https://trac-hacks.org/changeset/18709"
        class=3D"moz-txt-link-freetext">https://trac-hacks.org/changeset/18=
709</a>.</div>
    <div class=3D"moz-cite-prefix"><br>
    </div>
    <div class=3D"moz-cite-prefix">On 2025/09/27 18:05, Ales Horak wrote:<b=
r>
    </div>
    <blockquote type=3D"cite"
      cite=3D"mid:99108147-9d89-4159-b467-43257e803ec4n-/[email protected]">
      <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DUTF=
-8">
      Thank you.
      <div><br>
        <div>Another small patch attached that I needed for including an
          HTML page with UTF-8 encoding as
          `Include(<a class=3D"moz-txt-link-freetext" href=3D"http://www.ex=
ample.com/page.html">http://www.example.com/page.html</a>)` .</div>
        <div>Without decoding, the page is included as bytes with all
          special characters escaped.</div>
        <div>It might be better to enter the encoding as a parameter.</div>
        <div>--</div>
        <div>ales horak</div>
        <div><br>
          <br>
        </div>
        <div>
          <div dir=3D"auto">Dne st=C5=99eda 17. z=C3=A1=C5=99=C3=AD 2025=C2=
=A0v=C2=A04:13:15 UTC+2
            u=C5=BEivatel Jun Omae napsal:<br>
          </div>
          <blockquote
style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 20=
4); padding-left: 1ex;">
            <div>
              <div>Thanks for the feedback.</div>
              <div>I've committed the patch in=C2=A0<a
                  href=3D"https://trac-hacks.org/changeset/18706"
                  target=3D"_blank" rel=3D"nofollow" moz-do-not-send=3D"tru=
e">[18706]</a>.</div>
            </div>
            <div>
              <div><br>
              </div>
              <div>On 2025/09/14 16:27, Ale=C5=A1 Hor=C3=A1k wrote:<br>
              </div>
            </div>
            <div>
              <blockquote type=3D"cite">
                <div dir=3D"ltr">Hi,
                  <div><br>
                  </div>
                  <div>thank you. my patch was the minimum to get it to
                    work, just fixing the errors that appeared :-)</div>
                  <div><br>
                  </div>
                  <div>yours is more complete and functional=C2=A0=F0=9F=91=
=8D</div>
                  <div><br>
                  </div>
                  <div>-- <br>
                    ales horak<br>
                  </div>
                  <div><br>
                  </div>
                </div>
                <div><br clear=3D"all">
                </div>
                <div>
                  <div dir=3D"ltr">
                    <div dir=3D"ltr">-- <br>
                      Ale=C5=A1 Hor=C3=A1k</div>
                  </div>
                </div>
                <br>
                <br>
                <div>
                  <div dir=3D"ltr">ne 14. 9. 2025 v=C2=A05:53 odes=C3=ADlat=
el Jun
                    Omae &lt;<a href=3D"" rel=3D"nofollow"
                      moz-do-not-send=3D"true">[email protected]</a>&gt;
                    napsal:<br>
                  </div>
                  <blockquote
style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 20=
4); padding-left: 1ex;">Hi,<br>
                    <br>
                    On Sat, Sep 13, 2025 at 04:13:16AM -0700, Ales Horak
                    wrote:<br>
                    &gt; current <a
                      href=3D"https://trac-hacks.org/wiki/IncludeMacro"
                      rel=3D"noreferrer nofollow" target=3D"_blank"
                      moz-do-not-send=3D"true"
                      class=3D"moz-txt-link-freetext">https://trac-hacks.or=
g/wiki/IncludeMacro</a>
                    does not run under Trac 1.6<br>
                    &gt; due to genshi imports<br>
                    &gt; <br>
                    &gt; see the attached patch to make it functional<br>
                    &gt; <br>
                    &gt; --=C2=A0<br>
                    &gt; ales horak<br>
                    <br>
                    Thanks for the patch! However, it seems to be
                    incomplete.<br>
                    <br>
                    $ pyflakes includemacro/macros.py<br>
                    includemacro/macros.py:214:59: undefined name
                    'TracHTMLSanitizer'<br>
                    includemacro/macros.py:244:23: undefined name
                    'ParseError'<br>
                    includemacro/macros.py:255:27: undefined name
                    'ParseError'<br>
                    includemacro/macros.py:288:20: undefined name
                    'ParseError'<br>
                    <br>
                    Could you please try the attached patch?<br>
                    <br>
                    -- <br>
                    You received this message because you are subscribed
                    to a topic in the Google Groups "Trac Users" group.<br>
                    To unsubscribe from this topic, visit <a
href=3D"https://groups.google.com/d/topic/trac-users/oIX9bq6TkVc/unsubscrib=
e"
                      rel=3D"noreferrer nofollow" target=3D"_blank"
                      moz-do-not-send=3D"true"
                      class=3D"moz-txt-link-freetext">https://groups.google=
.com/d/topic/trac-users/oIX9bq6TkVc/unsubscribe</a>.<br>
                    To unsubscribe from this group and all its topics,
                    send an email to <a href=3D"" rel=3D"nofollow"
                      moz-do-not-send=3D"true">trac-users+...@googlegroups.=
com</a>.<br>
                    To view this discussion visit <a
href=3D"https://groups.google.com/d/msgid/trac-users/aMY8Eia7Pi0d/sOV%40loc=
alhost"
                      rel=3D"noreferrer nofollow" target=3D"_blank"
                      moz-do-not-send=3D"true"
                      class=3D"moz-txt-link-freetext">https://groups.google=
.com/d/msgid/trac-users/aMY8Eia7Pi0d/sOV%40localhost</a>.<br>
                  </blockquote>
                </div>
                -- <br>
              </blockquote>
            </div>
            <div>
              <blockquote type=3D"cite"> You received this message because
                you are subscribed to the Google Groups "Trac Users"
                group.<br>
                To unsubscribe from this group and stop receiving emails
                from it, send an email to <a href=3D"" rel=3D"nofollow"
                  moz-do-not-send=3D"true">trac-users+...-/[email protected]<=
/a>.<br>
                To view this discussion visit <a
href=3D"https://groups.google.com/d/msgid/trac-users/CAHm62qP8EwaOVoCpjNiTB=
ThhNNLAs6%2BGGrU6nznXEoX6AOPw7A%40mail.gmail.com?utm_medium=3Demail&amp;utm=
_source=3Dfooter"
                  target=3D"_blank" rel=3D"nofollow" moz-do-not-send=3D"tru=
e">https://groups.google.com/d/msgid/trac-users/CAHm62qP8EwaOVoCpjNiTBThhNN=
LAs6%2BGGrU6nznXEoX6AOPw7A%40mail.gmail.com</a>.<br>
              </blockquote>
              <p><br>
              </p>
              <span cols=3D"0">-- Jun Omae <a href=3D"" rel=3D"nofollow"
                  moz-do-not-send=3D"true">&lt;[email protected]&gt;</a>
                (=E5=A4=A7=E5=89=8D =E6=BD=A4)</span> </div>
          </blockquote>
        </div>
      </div>
      -- <br>
      You received this message because you are subscribed to the Google
      Groups "Trac Users" group.<br>
      To unsubscribe from this group and stop receiving emails from it,
      send an email to <a
        href=3D"mailto:trac-users+unsubscribe-/[email protected]"
        moz-do-not-send=3D"true" class=3D"moz-txt-link-freetext">trac-users=
+unsubscribe-/[email protected]</a>.<br>
      To view this discussion visit <a
href=3D"https://groups.google.com/d/msgid/trac-users/99108147-9d89-4159-b46=
7-43257e803ec4n%40googlegroups.com?utm_medium=3Demail&amp;utm_source=3Dfoot=
er"
        moz-do-not-send=3D"true">https://groups.google.com/d/msgid/trac-use=
rs/99108147-9d89-4159-b467-43257e803ec4n%40googlegroups.com</a>.<br>
    </blockquote>
    <p><br>
    </p>
    <pre class=3D"moz-signature" cols=3D"0">--=20
Jun Omae <a class=3D"moz-txt-link-rfc2396E" href=3D"mailto:[email protected]=
m">&lt;[email protected]&gt;</a> (=E5=A4=A7=E5=89=8D =E6=BD=A4)</pre>
  </body>
</html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Trac Users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:trac-users+unsubscribe-/[email protected]">trac-use=
rs+unsubscribe-/[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
trac-users/f8797b19-bf9f-4f06-abbd-e4c763be9272%40gmail.com?utm_medium=3Dem=
ail&utm_source=3Dfooter">https://groups.google.com/d/msgid/trac-users/f8797=
b19-bf9f-4f06-abbd-e4c763be9272%40gmail.com</a>.<br />

--------------eZF3XKbP2yGH95La1r0CI4xK--