How to prevent the creation of paragraphs while parsing?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to prevent the creation of paragraphs while parsing?

NorbertHartl
If I use something like

PRDocumentParser parse: '{{{<div/>}}}'

then it creates

PRDocument
  PRParagraph
     PRVerbatim

I like to avoid creating a paragraph which has a big influence on styles. If I'm not misled by firebug etc. than the verbatim is created after the paragraph leaving an empty paragraph right before the verbatim. Is this possible easily?

thanks,

Norbert

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: How to prevent the creation of paragraphs while parsing?

Nick
Hi Norbert,

I like to avoid creating a paragraph which has a big influence on styles. If I'm not misled by firebug etc. than the verbatim is created after the paragraph leaving an empty paragraph right before the verbatim. Is this possible easily?

I was holding off replying in case someone else came up with a better suggestion as I'm not terribly proud of the solution I came up with. For what it's worth, I've derived from PRPage (#IZPageWithoutEnclosingParagraph) and implemented #document: as:

---

document: aDocument
(aDocument hasChildren and: [ aDocument children size = 1 ])
ifTrue: [ 
| outerParagraph |
outerParagraph := aDocument children first.
outerParagraph class name = #PRParagraph
ifTrue: [ 
"remove the enclosing paragraph"
document := PRDocument withAll: outerParagraph children ] ].
document  isNil 
ifTrue: [ document := aDocument ]
ifFalse: [ document owner: self ]

---

I'm sure there's a more elegant way....

Nick

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: How to prevent the creation of paragraphs while parsing?

NorbertHartl

On 16.02.2011, at 01:15, Nick Ager wrote:

Hi Norbert,

I like to avoid creating a paragraph which has a big influence on styles. If I'm not misled by firebug etc. than the verbatim is created after the paragraph leaving an empty paragraph right before the verbatim. Is this possible easily?

I was holding off replying in case someone else came up with a better suggestion as I'm not terribly proud of the solution I came up with. For what it's worth, I've derived from PRPage (#IZPageWithoutEnclosingParagraph) and implemented #document: as:

---

document: aDocument
(aDocument hasChildren and: [ aDocument children size = 1 ])
ifTrue: [ 
| outerParagraph |
outerParagraph := aDocument children first.
outerParagraph class name = #PRParagraph
ifTrue: [ 
"remove the enclosing paragraph"
document := PRDocument withAll: outerParagraph children ] ].
document  isNil 
ifTrue: [ document := aDocument ]
ifFalse: [ document owner: self ]

---

I'm sure there's a more elegant way....

Thanks. I hope there is a more elegant way. My way at the moment is to do css display: none ;)

Norbert


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki