> On Nov 19, 2017, at 10:49 PM, a.bezle...@gmail.com wrote:
> 
> I need to export in "confluence storage format" - 
> https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html#ConfluenceStorageFormat-Links
>  
> <https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html#ConfluenceStorageFormat-Links>
> 


I just pushed an update that will handle "<![CDATA[···]]" strings correctly. 

Input (putting all the parts together in one file for demonstration purposes):

;;;

#lang pollen/pre
◊(require pollen/template/html)

◊(define (as-cdata string)
   (string-append "<![CDATA[" string "]]>"))

◊(->html
  ◊ac:link{
 ◊ri:attachment[#:ri:filename "atlassian_logo.gif"]{
  ◊ac:plain-text-link-body{◊as-cdata{Link to a Confluence Attachment}}}})

;;;

Result:

<ac:link><ri:attachment 
ri:filename="atlassian_logo.gif"><ac:plain-text-link-body><![CDATA[Link to a 
Confluence Attachment]]></ac:plain-text-link-body></ri:attachment></ac:link>

* * *

Supernerds might point out that this fix is a bit of a cheat: The official 
grammar for X-expressions includes the `cdata` structure type. [1] But Pollen 
still does not support this `cdata` structure directly.

The problem is that the `cdata` is an outlier in the grammar: it's the only 
element that can't be serialized (meaning, written to a string in a way that 
allows it to be reconstituted later). Pollen relies heavily on disk caching. So 
the problem is that these `cdata` objects can't be cached to disk. CDATA 
strings, however, can be.

I'm not sure what the deeper fix would be — probably to update Racket's `xml` 
module so that its structures, including `cdata`, are serializable.


[1] 
https://docs.racket-lang.org/xml/index.html?q=xexpr%3F#%28def._%28%28lib._xml%2Fprivate%2Fxexpr-core..rkt%29._xexpr~3f%29%29
 
<https://docs.racket-lang.org/xml/index.html?q=xexpr?#(def._((lib._xml/private/xexpr-core..rkt)._xexpr~3f))>

-- 
You received this message because you are subscribed to the Google Groups 
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pollenpub+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to