Re: [PATCH] removing nodes from a dom

Tidy Project <[email protected]> Mon, 13 Jul 2015 02:37:28 +0200
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <CAPuVx4OiS40L597qxJQNPVaOir-w_5C1mC7DB-tZNr7zXa6jag@mail.gmail.com>
--===============1199973563314942160==
Content-Type: multipart/alternative; boundary=089e0122e9ec21c1ee051ab6edb0

--089e0122e9ec21c1ee051ab6edb0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi folkert,

Thanks.. have seen the PR...

Had to do a bit of final release branch creation, overdue...

This PR could be the first 5.1.1 (development) master branch ;=3D))

You may need to rebase your fork... can help if needed,,,

Will test over the coming days... as time permits...

Hope this is the last here, since requires I login under another account...
but no problem...

Regards,
Geoff.

PS: My email client is instructed to ignore receipt requests, sorry...


On Sun, Jul 12, 2015 at 8:40 PM, folkert <[email protected]> wrote:

> Thanks for the reply.
> I've merged my patch (which has been extended for an attribute-deleter
> as well) into my github-fork. If all went well you've received a
> pull-request.
>
> Note that I DID test the node-delete (works for me, no valgrind errors
> either) but I did not yet test the attribute-delete (altough it
> compiles cleanly).
>
> On Sun, Jul 12, 2015 at 08:30:48PM +0200, Tidy Project wrote:
> > Hi folkert,
> >
> > The current development of tidy is here -
> >
> > https://github.com/htacg/tidy-html5
> >
> > It looks like a simple API extension, at no cost ;=3D))
> >
> > If you open an issue here -
> >
> > https://github.com/htacg/tidy-html5/issues
> >
> > it will certainly be considered... either as a patch, or PR...
> >
> > Thanks...
> >
> > Geoff.
> >
> >
> >
> > On Sun, Jul 12, 2015 at 2:36 PM, folkert <[email protected]> wrote=
:
> >
> > > Hi,
> > >
> > > Here's a patch for (lib-)tidy which allows developers to remove a nod=
e
> > > from a dom.
> > > I added this function so that I can use (lib-)tidy in a piece of code
> > > which removes dangerous html (dangerous for my use-case). For example
> > > scripting, iframes, etc.
> > > Please consider including it. Thanks.
> > >
> > >
> > > diff -uNrBbd tidy/include/tidy.h tidy-new/include/tidy.h
> > > --- tidy/include/tidy.h 2008-04-22 11:00:42.000000000 +0000
> > > +++ tidy-new/include/tidy.h     2015-07-12 11:59:11.251382612 +0000
> > > @@ -801,6 +801,9 @@
> > >  TIDY_EXPORT TidyNode TIDY_CALL    tidyGetHead( TidyDoc tdoc );
> > >  TIDY_EXPORT TidyNode TIDY_CALL    tidyGetBody( TidyDoc tdoc );
> > >
> > > +/* remove a node */
> > > +TIDY_EXPORT TidyNode TIDY_CALL    tidyDiscardElement( TidyDoc tdoc,
> > > TidyNode tnod );
> > > +
> > >  /* parent / child */
> > >  TIDY_EXPORT TidyNode TIDY_CALL    tidyGetParent( TidyNode tnod );
> > >  TIDY_EXPORT TidyNode TIDY_CALL    tidyGetChild( TidyNode tnod );
> > > diff -uNrBbd tidy/src/tidylib.c tidy-new/src/tidylib.c
> > > --- tidy/src/tidylib.c  2008-06-18 20:18:54.000000000 +0000
> > > +++ tidy-new/src/tidylib.c      2015-07-12 11:55:04.745221204 +0000
> > > @@ -1499,6 +1499,15 @@
> > >    return tidyImplToNode( nimp->content );
> > >  }
> > >
> > > +/* remove a node */
> > > +TidyNode TIDY_CALL    tidyDiscardElement( TidyDoc tdoc, TidyNode tno=
d
> )
> > > +{
> > > +  TidyDocImpl* doc =3D tidyDocToImpl( tdoc );
> > > +  Node* nimp =3D tidyNodeToImpl( tnod );
> > > +  Node* next =3D TY_(DiscardElement)( doc, nimp );
> > > +  return tidyImplToNode( next );
> > > +}
> > > +
> > >  /* siblings */
> > >  TidyNode TIDY_CALL    tidyGetNext( TidyNode tnod )
> > >  {
> > >
> > >
> > > Folkert van Heusden
> > >
> > > --
> > > MultiTail er et flexible tool for =C3=A5 kontrolere Logfiles og comma=
ndoer.
> > > Med filtrer, farger, sammenf=C3=B8ringer, forskeliger ansikter etc.
> > > http://www.vanheusden.com/multitail/
> > > ---------------------------------------------------------------------=
-
> > > Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
> > >
> > >
> > >
> -------------------------------------------------------------------------=
-----
> > > Don't Limit Your Business. Reach for the Cloud.
> > > GigeNET's Cloud Solutions provide you with the tools and support that
> > > you need to offload your IT needs and focus on growing your business.
> > > Configured For All Businesses. Start Your Cloud Today.
> > > https://www.gigenetcloud.com/
> > > _______________________________________________
> > > Tidy-develop mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/tidy-develop
> > >
>
>
> Folkert van Heusden
>
> --
> Wintips voor de staatsloterij? http://www.slimwinnen.nl/
>      Meer weten over Bitcoins? http://www.vanheusden.com/bitcoins/
>           Meer weten over TOR? http://www.vanheusden.com/tor/
> ----------------------------------------------------------------------
> Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
>

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

<div dir=3D"ltr">Hi folkert,<div><br></div><div>Thanks.. have seen the PR..=
.</div><div><br></div><div>Had to do a bit of final release branch creation=
, overdue...</div><div><br></div><div>This PR could be the first 5.1.1 (dev=
elopment) master branch ;=3D))</div><div><br></div><div>You may need to reb=
ase your fork... can help if needed,,,</div><div><br></div><div>Will test o=
ver the coming days... as time permits...</div><div><br></div><div>Hope thi=
s is the last here, since requires I login under another account... but no =
problem...</div><div><br></div><div>Regards,</div><div>Geoff.</div><div><br=
></div><div>PS: My email client is instructed to ignore receipt requests, s=
orry...</div><div><br></div></div><div class=3D"gmail_extra"><br><div class=
=3D"gmail_quote">On Sun, Jul 12, 2015 at 8:40 PM, folkert <span dir=3D"ltr"=
>&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">folkert@va=
nheusden.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks=
 for the reply.<br>
I&#39;ve merged my patch (which has been extended for an attribute-deleter<=
br>
as well) into my github-fork. If all went well you&#39;ve received a<br>
pull-request.<br>
<br>
Note that I DID test the node-delete (works for me, no valgrind errors<br>
either) but I did not yet test the attribute-delete (altough it<br>
compiles cleanly).<br>
<div><div class=3D"h5"><br>
On Sun, Jul 12, 2015 at 08:30:48PM +0200, Tidy Project wrote:<br>
&gt; Hi folkert,<br>
&gt;<br>
&gt; The current development of tidy is here -<br>
&gt;<br>
&gt; <a href=3D"https://github.com/htacg/tidy-html5" rel=3D"noreferrer" tar=
get=3D"_blank">https://github.com/htacg/tidy-html5</a><br>
&gt;<br>
&gt; It looks like a simple API extension, at no cost ;=3D))<br>
&gt;<br>
&gt; If you open an issue here -<br>
&gt;<br>
&gt; <a href=3D"https://github.com/htacg/tidy-html5/issues" rel=3D"noreferr=
er" target=3D"_blank">https://github.com/htacg/tidy-html5/issues</a><br>
&gt;<br>
&gt; it will certainly be considered... either as a patch, or PR...<br>
&gt;<br>
&gt; Thanks...<br>
&gt;<br>
&gt; Geoff.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Sun, Jul 12, 2015 at 2:36 PM, folkert &lt;<a href=3D"mailto:folkert=
@vanheusden.com">[email protected]</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; Here&#39;s a patch for (lib-)tidy which allows developers to remo=
ve a node<br>
&gt; &gt; from a dom.<br>
&gt; &gt; I added this function so that I can use (lib-)tidy in a piece of =
code<br>
&gt; &gt; which removes dangerous html (dangerous for my use-case). For exa=
mple<br>
&gt; &gt; scripting, iframes, etc.<br>
&gt; &gt; Please consider including it. Thanks.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; diff -uNrBbd tidy/include/tidy.h tidy-new/include/tidy.h<br>
&gt; &gt; --- tidy/include/tidy.h 2008-04-22 11:00:42.000000000 +0000<br>
&gt; &gt; +++ tidy-new/include/tidy.h=C2=A0 =C2=A0 =C2=A02015-07-12 11:59:1=
1.251382612 +0000<br>
&gt; &gt; @@ -801,6 +801,9 @@<br>
&gt; &gt;=C2=A0 TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetHead( Ti=
dyDoc tdoc );<br>
&gt; &gt;=C2=A0 TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetBody( Ti=
dyDoc tdoc );<br>
&gt; &gt;<br>
&gt; &gt; +/* remove a node */<br>
&gt; &gt; +TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyDiscardElement( =
TidyDoc tdoc,<br>
&gt; &gt; TidyNode tnod );<br>
&gt; &gt; +<br>
&gt; &gt;=C2=A0 /* parent / child */<br>
&gt; &gt;=C2=A0 TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetParent( =
TidyNode tnod );<br>
&gt; &gt;=C2=A0 TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetChild( T=
idyNode tnod );<br>
&gt; &gt; diff -uNrBbd tidy/src/tidylib.c tidy-new/src/tidylib.c<br>
&gt; &gt; --- tidy/src/tidylib.c=C2=A0 2008-06-18 20:18:54.000000000 +0000<=
br>
&gt; &gt; +++ tidy-new/src/tidylib.c=C2=A0 =C2=A0 =C2=A0 2015-07-12 11:55:0=
4.745221204 +0000<br>
&gt; &gt; @@ -1499,6 +1499,15 @@<br>
&gt; &gt;=C2=A0 =C2=A0 return tidyImplToNode( nimp-&gt;content );<br>
&gt; &gt;=C2=A0 }<br>
&gt; &gt;<br>
&gt; &gt; +/* remove a node */<br>
&gt; &gt; +TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyDiscardElement( TidyDoc tdoc=
, TidyNode tnod )<br>
&gt; &gt; +{<br>
&gt; &gt; +=C2=A0 TidyDocImpl* doc =3D tidyDocToImpl( tdoc );<br>
&gt; &gt; +=C2=A0 Node* nimp =3D tidyNodeToImpl( tnod );<br>
&gt; &gt; +=C2=A0 Node* next =3D TY_(DiscardElement)( doc, nimp );<br>
&gt; &gt; +=C2=A0 return tidyImplToNode( next );<br>
&gt; &gt; +}<br>
&gt; &gt; +<br>
&gt; &gt;=C2=A0 /* siblings */<br>
&gt; &gt;=C2=A0 TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetNext( TidyNode tnod =
)<br>
&gt; &gt;=C2=A0 {<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Folkert van Heusden<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; MultiTail er et flexible tool for =C3=A5 kontrolere Logfiles og c=
ommandoer.<br>
&gt; &gt; Med filtrer, farger, sammenf=C3=B8ringer, forskeliger ansikter et=
c.<br>
&gt; &gt; <a href=3D"http://www.vanheusden.com/multitail/" rel=3D"noreferre=
r" target=3D"_blank">http://www.vanheusden.com/multitail/</a><br>
&gt; &gt; -----------------------------------------------------------------=
-----<br>
&gt; &gt; Phone: <a href=3D"tel:%2B31-6-41278122" value=3D"+31641278122">+3=
1-6-41278122</a>, PGP-key: 1F28D8AE, <a href=3D"http://www.vanheusden.com" =
rel=3D"noreferrer" target=3D"_blank">www.vanheusden.com</a><br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; -----------------------------------------------------------------=
-------------<br>
&gt; &gt; Don&#39;t Limit Your Business. Reach for the Cloud.<br>
&gt; &gt; GigeNET&#39;s Cloud Solutions provide you with the tools and supp=
ort that<br>
&gt; &gt; you need to offload your IT needs and focus on growing your busin=
ess.<br>
&gt; &gt; Configured For All Businesses. Start Your Cloud Today.<br>
&gt; &gt; <a href=3D"https://www.gigenetcloud.com/" rel=3D"noreferrer" targ=
et=3D"_blank">https://www.gigenetcloud.com/</a><br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; Tidy-develop mailing list<br>
&gt; &gt; <a href=3D"mailto:[email protected]">Tidy-develo=
[email protected]</a><br>
&gt; &gt; <a href=3D"https://lists.sourceforge.net/lists/listinfo/tidy-deve=
lop" rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lis=
ts/listinfo/tidy-develop</a><br>
&gt; &gt;<br>
<br>
<br>
</div></div>Folkert van Heusden<br>
<span class=3D"HOEnZb"><font color=3D"#888888"><br>
--<br>
Wintips voor de staatsloterij? <a href=3D"http://www.slimwinnen.nl/" rel=3D=
"noreferrer" target=3D"_blank">http://www.slimwinnen.nl/</a><br>
=C2=A0 =C2=A0 =C2=A0Meer weten over Bitcoins? <a href=3D"http://www.vanheus=
den.com/bitcoins/" rel=3D"noreferrer" target=3D"_blank">http://www.vanheusd=
en.com/bitcoins/</a><br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Meer weten over TOR? <a href=3D"http://w=
ww.vanheusden.com/tor/" rel=3D"noreferrer" target=3D"_blank">http://www.van=
heusden.com/tor/</a><br>
</font></span><div class=3D"HOEnZb"><div class=3D"h5">---------------------=
-------------------------------------------------<br>
Phone: <a href=3D"tel:%2B31-6-41278122" value=3D"+31641278122">+31-6-412781=
22</a>, PGP-key: 1F28D8AE, <a href=3D"http://www.vanheusden.com" rel=3D"nor=
eferrer" target=3D"_blank">www.vanheusden.com</a><br>
</div></div></blockquote></div><br></div>

--089e0122e9ec21c1ee051ab6edb0--


--===============1199973563314942160==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
--===============1199973563314942160==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tidy-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tidy-develop

--===============1199973563314942160==--