BOLatexWriter

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

BOLatexWriter

Tudor Girba-2
Hi,

I am testing Pier 2 some more, and now I got a problem in the Latex writer. Specifically, I do not quite understand the difference between the latex instance variable and the inherited stream one.

Take a look at the snippet below:

BOLatexWriter>>visitInternalLink: anInternalLink
                ...
                latex tab ... square: [ stream nextPutAll: 'width='; print: ((anInternalLink parameterAt: 'width' ifAbsent: [ 100 ]) asNumber / 100.0); ... ]

When executed on a book we have two instance variables:
- stream: instance of GRPharoUtf8CodecStream (inherited)
- latex: instance of BOLatexStream which wraps stream

Now, it so happens that GRPharoUtf8CodecStream does not understand print:, but this method exists in BOLatexStream. I fixed the code by replacing stream with latex in the above method, and it works.

But, there are still other places that use stream, and I think they should all use the BOLatexStream instance instead. So, my question is: Is this intentional? Or maybe should we actually simply override the setting of stream and use that one for everything?

Cheers,
Doru



--
www.tudorgirba.com

"Yesterday is a fact.
 Tomorrow is a possibility.
 Today is a challenge."




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

Re: BOLatexWriter

Lukas Renggli
Yes, this is intentional: 'stream' is the raw low-level stream, 'latex' is the high-level encoded stream. The choice to which you send the output is important. Changing it likely breaks the generation of valid LaTeX.

GRPharoUtf8CodecStream or better its abstract superclass should implement #print:. I think this was discussed in the Seaside list recently and fixed, but I might be wrong.

Lukas

On Saturday, 24 September 2011, Tudor Girba <[hidden email]> wrote:
> Hi,
>
> I am testing Pier 2 some more, and now I got a problem in the Latex writer. Specifically, I do not quite understand the difference between the latex instance variable and the inherited stream one.
>
> Take a look at the snippet below:
>
> BOLatexWriter>>visitInternalLink: anInternalLink
>                ...
>                latex tab ... square: [ stream nextPutAll: 'width='; print: ((anInternalLink parameterAt: 'width' ifAbsent: [ 100 ]) asNumber / 100.0); ... ]
>
> When executed on a book we have two instance variables:
> - stream: instance of GRPharoUtf8CodecStream (inherited)
> - latex: instance of BOLatexStream which wraps stream
>
> Now, it so happens that GRPharoUtf8CodecStream does not understand print:, but this method exists in BOLatexStream. I fixed the code by replacing stream with latex in the above method, and it works.
>
> But, there are still other places that use stream, and I think they should all use the BOLatexStream instance instead. So, my question is: Is this intentional? Or maybe should we actually simply override the setting of stream and use that one for everything?
>

> Cheers,
> Doru
>
>
>
> --
> www.tudorgirba.com
>
> "Yesterday is a fact.
>  Tomorrow is a possibility.
>  Today is a challenge."
>
>
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>

--
Lukas Renggli
www.lukas-renggli.ch

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

Re: BOLatexWriter

Tudor Girba-2
Hi,

Thanks. In the latest version of all Grease packages and the print: method is not around in the Stream hierarchy.

So, for is it Ok to have the fix in BOLatexWriter>>visitInternalLink: by replacing stream with latex to work with print: or do you see problems there?

Cheers,
Doru


On 24 Sep 2011, at 23:11, Lukas Renggli wrote:

> Yes, this is intentional: 'stream' is the raw low-level stream, 'latex' is the high-level encoded stream. The choice to which you send the output is important. Changing it likely breaks the generation of valid LaTeX.
>
> GRPharoUtf8CodecStream or better its abstract superclass should implement #print:. I think this was discussed in the Seaside list recently and fixed, but I might be wrong.
>
> Lukas
>
> On Saturday, 24 September 2011, Tudor Girba <[hidden email]> wrote:
> > Hi,
> >
> > I am testing Pier 2 some more, and now I got a problem in the Latex writer. Specifically, I do not quite understand the difference between the latex instance variable and the inherited stream one.
> >
> > Take a look at the snippet below:
> >
> > BOLatexWriter>>visitInternalLink: anInternalLink
> >                ...
> >                latex tab ... square: [ stream nextPutAll: 'width='; print: ((anInternalLink parameterAt: 'width' ifAbsent: [ 100 ]) asNumber / 100.0); ... ]
> >
> > When executed on a book we have two instance variables:
> > - stream: instance of GRPharoUtf8CodecStream (inherited)
> > - latex: instance of BOLatexStream which wraps stream
> >
> > Now, it so happens that GRPharoUtf8CodecStream does not understand print:, but this method exists in BOLatexStream. I fixed the code by replacing stream with latex in the above method, and it works.
> >
> > But, there are still other places that use stream, and I think they should all use the BOLatexStream instance instead. So, my question is: Is this intentional? Or maybe should we actually simply override the setting of stream and use that one for everything?
> >
> > Cheers,
> > Doru
> >
> >
> >
> > --
> > www.tudorgirba.com
> >
> > "Yesterday is a fact.
> >  Tomorrow is a possibility.
> >  Today is a challenge."
> >
> >
> >
> >
> > _______________________________________________
> > Magritte, Pier and Related Tools ...
> > https://www.iam.unibe.ch/mailman/listinfo/smallwiki
> >
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

--
www.tudorgirba.com

"From an abstract enough point of view, any two things are similar."




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

Re: [Seaside] BOLatexWriter

Tudor Girba-2
Thanks, it works.

Now, we have a followup problem in BOLatexStream

BOLatexStream>>print: anObject
        anObject isNil
                ifTrue: [ ^ self ].
        anObject isBlock
                ifTrue: [ anObject value ]
                ifFalse: [ self nextPutAll: anObject displayString ]

displayString is deprecated, and I am not quite sure what it should be replaced with. I guess it should be printString, or we should just delegate to the print: of the inner stream.

What do you say?

Cheers,
Doru


On 25 Sep 2011, at 10:16, Lukas Renggli wrote:

> Have a look if
>
>   Name: Grease-Core-lr.66
>   Author: lr
>   Time: 25 September 2011, 10:13:37 am
>   UUID: 0a3221fb-c5d8-4ce1-b139-0e6dc72481a2
>   Ancestors: Grease-Core-dkh.65
>
>   - add GRCodecStream>>#print:
>
> fixes the problem?
>
> Lukas
>
> On 25 September 2011 09:53, Tudor Girba <[hidden email]> wrote:
>> Hi,
>>
>>
>> On 25 Sep 2011, at 08:49, Lukas Renggli wrote:
>>
>>>> Thanks. In the latest version of all Grease packages and the print: method is not around in the Stream hierarchy.
>>>
>>> Ok, then it should be added.
>>>
>>>> So, for is it Ok to have the fix in BOLatexWriter>>visitInternalLink: by replacing stream with latex to work with print: or do you see problems there?
>>>
>>> No, the two strams don't have te same semantics. stream print: '\' should print '\'; latex print: '\' should print '\\'.
>>
>> Right. I got the difference now.
>>
>> But, I still would not know how to implement GRXYZStream>>print:, because I am not sure I understand what is the difference between print: and nextPutAll:. Could anyone help with this matter?
>>
>> Cheers,
>> Doru
>>
>>
>>
>>> Lukas
>>>
>>>>
>>>> Cheers,
>>>> Doru
>>>>
>>>>
>>>> On 24 Sep 2011, at 23:11, Lukas Renggli wrote:
>>>>
>>>>> Yes, this is intentional: 'stream' is the raw low-level stream, 'latex' is the high-level encoded stream. The choice to which you send the output is important. Changing it likely breaks the generation of valid LaTeX.
>>>>>
>>>>> GRPharoUtf8CodecStream or better its abstract superclass should implement #print:. I think this was discussed in the Seaside list recently and fixed, but I might be wrong.
>>>>>
>>>>> Lukas
>>>>>
>>>>> On Saturday, 24 September 2011, Tudor Girba <[hidden email]> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I am testing Pier 2 some more, and now I got a problem in the Latex writer. Specifically, I do not quite understand the difference between the latex instance variable and the inherited stream one.
>>>>>>
>>>>>> Take a look at the snippet below:
>>>>>>
>>>>>> BOLatexWriter>>visitInternalLink: anInternalLink
>>>>>>                ...
>>>>>>                latex tab ... square: [ stream nextPutAll: 'width='; print: ((anInternalLink parameterAt: 'width' ifAbsent: [ 100 ]) asNumber / 100.0); ... ]
>>>>>>
>>>>>> When executed on a book we have two instance variables:
>>>>>> - stream: instance of GRPharoUtf8CodecStream (inherited)
>>>>>> - latex: instance of BOLatexStream which wraps stream
>>>>>>
>>>>>> Now, it so happens that GRPharoUtf8CodecStream does not understand print:, but this method exists in BOLatexStream. I fixed the code by replacing stream with latex in the above method, and it works.
>>>>>>
>>>>>> But, there are still other places that use stream, and I think they should all use the BOLatexStream instance instead. So, my question is: Is this intentional? Or maybe should we actually simply override the setting of stream and use that one for everything?
>>>>>>
>>>>>> Cheers,
>>>>>> Doru
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> www.tudorgirba.com
>>>>>>
>>>>>> "Yesterday is a fact.
>>>>>>  Tomorrow is a possibility.
>>>>>>  Today is a challenge."
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Magritte, Pier and Related Tools ...
>>>>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>>>>>
>>>>>
>>>>> --
>>>>> Lukas Renggli
>>>>> www.lukas-renggli.ch
>>>>> _______________________________________________
>>>>> Magritte, Pier and Related Tools ...
>>>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>>>
>>>> --
>>>> www.tudorgirba.com
>>>>
>>>> "From an abstract enough point of view, any two things are similar."
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> seaside mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>
>>>
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>> --
>> www.tudorgirba.com
>>
>> "In a world where everything is moving ever faster,
>> one might have better chances to win by moving slower."
>>
>>
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

--
www.tudorgirba.com

"In a world where everything is moving ever faster,
one might have better chances to win by moving slower."




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

Re: [Seaside] BOLatexWriter

Lukas Renggli
On 25 September 2011 10:57, Tudor Girba <[hidden email]> wrote:

> Thanks, it works.
>
> Now, we have a followup problem in BOLatexStream
>
> BOLatexStream>>print: anObject
>        anObject isNil
>                ifTrue: [ ^ self ].
>        anObject isBlock
>                ifTrue: [ anObject value ]
>                ifFalse: [ self nextPutAll: anObject displayString ]
>
> displayString is deprecated, and I am not quite sure what it should be replaced with. I guess it should be printString, or we should just delegate to the print: of the inner stream.
>
> What do you say?

No, #printString is only for developer facing strings; use
#greaseString, the platform independent #displayString for user facing
strings.

Lukas

>
> Cheers,
> Doru
>
>
> On 25 Sep 2011, at 10:16, Lukas Renggli wrote:
>
>> Have a look if
>>
>>   Name: Grease-Core-lr.66
>>   Author: lr
>>   Time: 25 September 2011, 10:13:37 am
>>   UUID: 0a3221fb-c5d8-4ce1-b139-0e6dc72481a2
>>   Ancestors: Grease-Core-dkh.65
>>
>>   - add GRCodecStream>>#print:
>>
>> fixes the problem?
>>
>> Lukas
>>
>> On 25 September 2011 09:53, Tudor Girba <[hidden email]> wrote:
>>> Hi,
>>>
>>>
>>> On 25 Sep 2011, at 08:49, Lukas Renggli wrote:
>>>
>>>>> Thanks. In the latest version of all Grease packages and the print: method is not around in the Stream hierarchy.
>>>>
>>>> Ok, then it should be added.
>>>>
>>>>> So, for is it Ok to have the fix in BOLatexWriter>>visitInternalLink: by replacing stream with latex to work with print: or do you see problems there?
>>>>
>>>> No, the two strams don't have te same semantics. stream print: '\' should print '\'; latex print: '\' should print '\\'.
>>>
>>> Right. I got the difference now.
>>>
>>> But, I still would not know how to implement GRXYZStream>>print:, because I am not sure I understand what is the difference between print: and nextPutAll:. Could anyone help with this matter?
>>>
>>> Cheers,
>>> Doru
>>>
>>>
>>>
>>>> Lukas
>>>>
>>>>>
>>>>> Cheers,
>>>>> Doru
>>>>>
>>>>>
>>>>> On 24 Sep 2011, at 23:11, Lukas Renggli wrote:
>>>>>
>>>>>> Yes, this is intentional: 'stream' is the raw low-level stream, 'latex' is the high-level encoded stream. The choice to which you send the output is important. Changing it likely breaks the generation of valid LaTeX.
>>>>>>
>>>>>> GRPharoUtf8CodecStream or better its abstract superclass should implement #print:. I think this was discussed in the Seaside list recently and fixed, but I might be wrong.
>>>>>>
>>>>>> Lukas
>>>>>>
>>>>>> On Saturday, 24 September 2011, Tudor Girba <[hidden email]> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am testing Pier 2 some more, and now I got a problem in the Latex writer. Specifically, I do not quite understand the difference between the latex instance variable and the inherited stream one.
>>>>>>>
>>>>>>> Take a look at the snippet below:
>>>>>>>
>>>>>>> BOLatexWriter>>visitInternalLink: anInternalLink
>>>>>>>                ...
>>>>>>>                latex tab ... square: [ stream nextPutAll: 'width='; print: ((anInternalLink parameterAt: 'width' ifAbsent: [ 100 ]) asNumber / 100.0); ... ]
>>>>>>>
>>>>>>> When executed on a book we have two instance variables:
>>>>>>> - stream: instance of GRPharoUtf8CodecStream (inherited)
>>>>>>> - latex: instance of BOLatexStream which wraps stream
>>>>>>>
>>>>>>> Now, it so happens that GRPharoUtf8CodecStream does not understand print:, but this method exists in BOLatexStream. I fixed the code by replacing stream with latex in the above method, and it works.
>>>>>>>
>>>>>>> But, there are still other places that use stream, and I think they should all use the BOLatexStream instance instead. So, my question is: Is this intentional? Or maybe should we actually simply override the setting of stream and use that one for everything?
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Doru
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> www.tudorgirba.com
>>>>>>>
>>>>>>> "Yesterday is a fact.
>>>>>>>  Tomorrow is a possibility.
>>>>>>>  Today is a challenge."
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Magritte, Pier and Related Tools ...
>>>>>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Lukas Renggli
>>>>>> www.lukas-renggli.ch
>>>>>> _______________________________________________
>>>>>> Magritte, Pier and Related Tools ...
>>>>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>>>>
>>>>> --
>>>>> www.tudorgirba.com
>>>>>
>>>>> "From an abstract enough point of view, any two things are similar."
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> seaside mailing list
>>>>> [hidden email]
>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>
>>>>
>>>> --
>>>> Lukas Renggli
>>>> www.lukas-renggli.ch
>>>> _______________________________________________
>>>> seaside mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>> --
>>> www.tudorgirba.com
>>>
>>> "In a world where everything is moving ever faster,
>>> one might have better chances to win by moving slower."
>>>
>>>
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> --
> www.tudorgirba.com
>
> "In a world where everything is moving ever faster,
> one might have better chances to win by moving slower."
>
>
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch

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