Re: [PHPTAL] XML Namespace and xmlns declaration removed from emitted DOM

2012-06-13 Thread Andrew Crites
I don't think we need either of:

* A new input mode
* Invalid output for compliance with Google's proprietary element.

There is a way to display a plusone button without using that element and
using valid HTML instead.

PHPTAL's HTML5 output is not as strict as I think it should be in that it
allows invalid elements and invalid nesting, but that would be a separate
discussion.  It may be good to be lenient on that too.

PHPTAL allows invalid input XML as well, but never mind.

What I think would be useful would be to have some directive that prevents
PHPTAL from doing any preprocessing on the input and outputs it raw.  I
think this makes sense since that can keep the DOM together and a hack
using variables like in my first email is not necessary.

Inside CDATA, html is escaped (unless the CDATA is inside script tags).  I
think it should be left alone.

I also like the idea of  -- currently
that looks for a `structure` variable.   would do as well in my opinion, but the parser needs to know to
overlook the content.

On Tue, Jun 12, 2012 at 7:05 PM, Kornel Lesiński wrote:

> On Tue, 12 Jun 2012 21:50:15 +0100, Hisateru Tanaka <
> tanakahisat...@gmail.com> wrote:
>
>  In another branch I started to let PHPTAL allow using with illegal
>> namespace. See:
>> https://github.com/pornel/**PHPTAL/compare/html5_with_ns#**L4R97
>>
>
> Thanks for fixing empty elements and HTML5 attributes!
>
> I think the namespace fix needs to handle some more cases:
>
> http://www.w3.org/1999/**xhtml
> ">
>
> must be output in HTML5 mode as:
>
> 
>
> since that's a proper XHTML input from XML/DOM perspective. That's why the
> code was ignoring prefixes.
>
>
> I wouldn't mind if:
>
> http://example.com/**foons 
> ">
>
> was output as:
>
> 
>
> although it saddens me that's needed only for Google's invalid markup and
> now-deprecated FBML.
>
>
> I'm not so sure about xmlns attributes. The "http://www.w3.org/1999/xhtml";
> declaration is certainly not needed in HTML5. I think it may be better to
> omit other xmlns attributes too to avoid giving false impression that HTML5
> has namespaces. It only has tags with invalid ":" character in them and
> ignores xmlns attributes for compatibility with "polyglot" XHTML documents
> (but HTML5 mode is inappropriate for polyglot documents).
>
> Even in HTML5 output mode PHPTAL still is supposed to parse input as XML.
> As long as TAL claims to be XML-based language I think it should follow XML
> rule and require namespace declarations.
>
> Ignoring of namespace declarations would be appropriate if PHPTAL had
> HTML5 *input* mode (parse HTML5 and output it as either HTML5 or XHTML).
>
> --
> regards, Kornel Lesiński
>
>
> __**_
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/**mailman/listinfo/phptal
>



-- 
Andrew Crites
Chief of http://AySites.com/
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] XML Namespace and xmlns declaration removed from emitted DOM

2012-06-12 Thread Kornel Lesiński
On Tue, 12 Jun 2012 21:50:15 +0100, Hisateru Tanaka  
 wrote:



In another branch I started to let PHPTAL allow using with illegal
namespace. See:
https://github.com/pornel/PHPTAL/compare/html5_with_ns#L4R97


Thanks for fixing empty elements and HTML5 attributes!

I think the namespace fix needs to handle some more cases:

http://www.w3.org/1999/xhtml";>

must be output in HTML5 mode as:



since that's a proper XHTML input from XML/DOM perspective. That's why the  
code was ignoring prefixes.



I wouldn't mind if:

http://example.com/foons";>

was output as:



although it saddens me that's needed only for Google's invalid markup and  
now-deprecated FBML.



I'm not so sure about xmlns attributes. The "http://www.w3.org/1999/xhtml";  
declaration is certainly not needed in HTML5. I think it may be better to  
omit other xmlns attributes too to avoid giving false impression that  
HTML5 has namespaces. It only has tags with invalid ":" character in them  
and ignores xmlns attributes for compatibility with "polyglot" XHTML  
documents (but HTML5 mode is inappropriate for polyglot documents).


Even in HTML5 output mode PHPTAL still is supposed to parse input as XML.  
As long as TAL claims to be XML-based language I think it should follow  
XML rule and require namespace declarations.


Ignoring of namespace declarations would be appropriate if PHPTAL had  
HTML5 *input* mode (parse HTML5 and output it as either HTML5 or XHTML).


--
regards, Kornel Lesiński

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] XML Namespace and xmlns declaration removed from emitted DOM

2012-06-12 Thread Hisateru Tanaka
2012/6/13 Andrew Crites :
> It's known that when you have an element like:
>
>     http://aysites.com/";>
>
> PHPTAL will throw an error ("There is no namespace declared...")
>
> You can solve this error simply by adding an `xmlns:g` attribute to the
> element or one of its ancestores.
>
> However, if you do that, PHPTAL will emit:
>
>     ...
>
> and drop the `g`.
>
> This is a problem the script for the Google plus one button will not be able
> to find the element since it's looking specifically for ``
> (apparently).  This problem is probably not specific to the plus one button.
>
> My solution is to have something like:
>
>     
>
> And `plusonebutton` in PHP code is the invalid XML `g:plusone` element, but
> this is ugly.
>
> Is there any way to have the element directly in the DOM and keep the `g:`
> prefix in PHPTAL and still have valid input XML?
>
> Barring that, is there any way to have invalid XML in the input and have
> PHPTAL skip parsing it and emit it raw (CDATA is escaped)?
>
> --
> Andrew Crites
> Chief of http://AySites.com/

In another branch I started to let PHPTAL allow using with illegal
namespace. See:
https://github.com/pornel/PHPTAL/compare/html5_with_ns#L4R97

Under older implementation

http://www.w3.org/1999/xhtml";>
  http://www.w3.org/1999/xhtml"/>

was changed to



... instead I think that it should be saved as is if in HTML5 mode.

Today HTML5 is used with XHTML's namespace syntax mixed. PHPTAL should
follow this trend rather than being strict, I think. How about?

-- 
Hisateru Tanaka

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] XML Namespace and xmlns declaration removed from emitted DOM

2012-06-12 Thread Andrew Crites
Dearest Terin,

You are correct that using XHTML as the output mode keeps the `xmlns`
attribute and also the g: as part of the element.  Problem is, I want to
use an HTML output mode.

However, The plus one API does allow you to load on a specified element,
which obviates the need for the `g:plusone` element so I can get around it
that way.

On Tue, Jun 12, 2012 at 12:05 PM, Terin Stock  wrote:

> Hey Andrew:
>
> You could probably setup a postfilter to remove the gplusone element and
> add a g:plusone element in  it place. (I believe I had a postfilter doing
> something very similar for FAR/AIM, it's probably still around.)
>
> For the pages in question, are you generating HTML pages or XHTML pages?
> As far as I know, namespaces aren't valid in documents that aren't XHTML.
> Can you see if switching the output fixes it?
>
> --
> #Terin Stock
>
>
> On Tue, Jun 12, 2012 at 11:19 AM, Andrew Crites wrote:
>
>> It's known that when you have an element like:
>>
>> http://aysites.com/";>
>>
>> PHPTAL will throw an error ("There is no namespace declared...")
>>
>> You can solve this error simply by adding an `xmlns:g` attribute to the
>> element or one of its ancestores.
>>
>> However, if you do that, PHPTAL will emit:
>>
>> ...
>>
>> and drop the `g`.
>>
>> This is a problem the script for the Google plus one button will not be
>> able to find the element since it's looking specifically for ``
>> (apparently).  This problem is probably not specific to the plus one button.
>>
>> My solution is to have something like:
>>
>> 
>>
>> And `plusonebutton` in PHP code is the invalid XML `g:plusone` element,
>> but this is ugly.
>>
>> Is there any way to have the element directly in the DOM and keep the
>> `g:` prefix in PHPTAL and still have valid input XML?
>>
>> Barring that, is there any way to have invalid XML in the input and have
>> PHPTAL skip parsing it and emit it raw (CDATA is escaped)?
>>
>> --
>> Andrew Crites
>> Chief of http://AySites.com/
>>
>>
>> ___
>> PHPTAL mailing list
>> PHPTAL@lists.motion-twin.com
>> http://lists.motion-twin.com/mailman/listinfo/phptal
>>
>>
>
> ___
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>


-- 
Andrew Crites
Chief of http://AySites.com/
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] XML Namespace and xmlns declaration removed from emitted DOM

2012-06-12 Thread Terin Stock
Hey Andrew:

You could probably setup a postfilter to remove the gplusone element and
add a g:plusone element in  it place. (I believe I had a postfilter doing
something very similar for FAR/AIM, it's probably still around.)

For the pages in question, are you generating HTML pages or XHTML pages? As
far as I know, namespaces aren't valid in documents that aren't XHTML. Can
you see if switching the output fixes it?

-- 
#Terin Stock


On Tue, Jun 12, 2012 at 11:19 AM, Andrew Crites  wrote:

> It's known that when you have an element like:
>
> http://aysites.com/";>
>
> PHPTAL will throw an error ("There is no namespace declared...")
>
> You can solve this error simply by adding an `xmlns:g` attribute to the
> element or one of its ancestores.
>
> However, if you do that, PHPTAL will emit:
>
> ...
>
> and drop the `g`.
>
> This is a problem the script for the Google plus one button will not be
> able to find the element since it's looking specifically for ``
> (apparently).  This problem is probably not specific to the plus one button.
>
> My solution is to have something like:
>
> 
>
> And `plusonebutton` in PHP code is the invalid XML `g:plusone` element,
> but this is ugly.
>
> Is there any way to have the element directly in the DOM and keep the `g:`
> prefix in PHPTAL and still have valid input XML?
>
> Barring that, is there any way to have invalid XML in the input and have
> PHPTAL skip parsing it and emit it raw (CDATA is escaped)?
>
> --
> Andrew Crites
> Chief of http://AySites.com/
>
>
> ___
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal