Re: [PATCH] removing nodes from a dom
Tidy Project <[email protected]> Sun, 12 Jul 2015 20:30:48 +0200
| Newsgroups | gmane.comp.web.html-tidy.devel |
|---|---|
| Message-ID | <CAPuVx4O0Vm8b1J7q0xWXSU+6mjKqX1FAQvt2AcmAKvSXd0qHog@mail.gmail.com> |
--===============0768390328345760342== Content-Type: multipart/alternative; boundary=bcaec517c5bed8b614051ab1cde3 --bcaec517c5bed8b614051ab1cde3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 node > 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 tnod ) > +{ > + 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 commandoe= r. > 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 > --bcaec517c5bed8b614051ab1cde3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi folkert,<div><br></div><div>The current development of = tidy is here -</div><div><br></div><div><a href=3D"https://github.com/htacg= /tidy-html5">https://github.com/htacg/tidy-html5</a><br></div><div><br></di= v><div>It looks like a simple API extension, at no cost ;=3D))</div><div><b= r></div><div>If you open an issue here -</div><div><br></div><div><a href= =3D"https://github.com/htacg/tidy-html5/issues">https://github.com/htacg/ti= dy-html5/issues</a><br></div><div><br></div><div>it will certainly be consi= dered... either as a patch, or PR...</div><div><br></div><div>Thanks...</di= v><div><br></div><div>Geoff.</div><div><br></div><div><br></div></div><div = class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Sun, Jul 12, 2015 a= t 2:36 PM, folkert <span dir=3D"ltr"><<a href=3D"mailto:folkert@vanheusd= en.com" target=3D"_blank">[email protected]</a>></span> wrote:<br><= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">Hi,<br> <br> Here's a patch for (lib-)tidy which allows developers to remove a node<= br> from a dom.<br> I added this function so that I can use (lib-)tidy in a piece of code<br> which removes dangerous html (dangerous for my use-case). For example<br> scripting, iframes, etc.<br> Please consider including it. Thanks.<br> <br> <br> diff -uNrBbd tidy/include/tidy.h tidy-new/include/tidy.h<br> --- tidy/include/tidy.h 2008-04-22 11:00:42.000000000 +0000<br> +++ tidy-new/include/tidy.h=C2=A0 =C2=A0 =C2=A02015-07-12 11:59:11.25138261= 2 +0000<br> @@ -801,6 +801,9 @@<br> =C2=A0TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetHead( TidyDoc tdoc= );<br> =C2=A0TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetBody( TidyDoc tdoc= );<br> <br> +/* remove a node */<br> +TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyDiscardElement( TidyDoc td= oc, TidyNode tnod );<br> +<br> =C2=A0/* parent / child */<br> =C2=A0TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetParent( TidyNode t= nod );<br> =C2=A0TIDY_EXPORT TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetChild( TidyNode tn= od );<br> diff -uNrBbd tidy/src/tidylib.c tidy-new/src/tidylib.c<br> --- tidy/src/tidylib.c=C2=A0 2008-06-18 20:18:54.000000000 +0000<br> +++ tidy-new/src/tidylib.c=C2=A0 =C2=A0 =C2=A0 2015-07-12 11:55:04.74522120= 4 +0000<br> @@ -1499,6 +1499,15 @@<br> =C2=A0 =C2=A0return tidyImplToNode( nimp->content );<br> =C2=A0}<br> <br> +/* remove a node */<br> +TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyDiscardElement( TidyDoc tdoc, TidyNode= tnod )<br> +{<br> +=C2=A0 TidyDocImpl* doc =3D tidyDocToImpl( tdoc );<br> +=C2=A0 Node* nimp =3D tidyNodeToImpl( tnod );<br> +=C2=A0 Node* next =3D TY_(DiscardElement)( doc, nimp );<br> +=C2=A0 return tidyImplToNode( next );<br> +}<br> +<br> =C2=A0/* siblings */<br> =C2=A0TidyNode TIDY_CALL=C2=A0 =C2=A0 tidyGetNext( TidyNode tnod )<br> =C2=A0{<br> <br> <br> Folkert van Heusden<br> <br> --<br> MultiTail er et flexible tool for =C3=A5 kontrolere Logfiles og commandoer.= <br> Med filtrer, farger, sammenf=C3=B8ringer, forskeliger ansikter etc.<br> <a href=3D"http://www.vanheusden.com/multitail/" rel=3D"noreferrer" target= =3D"_blank">http://www.vanheusden.com/multitail/</a><br> ----------------------------------------------------------------------<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> <br> ---------------------------------------------------------------------------= ---<br> Don't Limit Your Business. Reach for the Cloud.<br> GigeNET's Cloud Solutions provide you with the tools and support that<b= r> you need to offload your IT needs and focus on growing your business.<br> Configured For All Businesses. Start Your Cloud Today.<br> <a href=3D"https://www.gigenetcloud.com/" rel=3D"noreferrer" target=3D"_bla= nk">https://www.gigenetcloud.com/</a><br> _______________________________________________<br> Tidy-develop mailing list<br> <a href=3D"mailto:[email protected]">[email protected]= urceforge.net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/tidy-develop" rel= =3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi= nfo/tidy-develop</a><br> </blockquote></div><br></div> --bcaec517c5bed8b614051ab1cde3-- --===============0768390328345760342== 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/ --===============0768390328345760342== 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 --===============0768390328345760342==--