[squeak-dev] The Inbox: Collections-eem.732.mcz -- HtmlReadWriter

H. Hirzel hannes.hirzel at gmail.com
Fri Feb 10 13:59:34 UTC 2017


Nice!

On 2/10/17, Tobias Pape <Das.Linux at gmx.de> wrote:
>
> On 10.02.2017, at 00:56, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
>> But the current scheme loses the pargraph indent anyway.
>
> No, it doesn't?
>
> writeContent: aString
>
> 	aString do: [:char |
> 		(#(10 13) includes: char asciiValue)
> 			ifTrue: [self cr]
> 			ifFalse: [char = Character tab
> 				ifTrue: [self nextPutAll: '    ']
> 				ifFalse: [(String htmlEntities keyAtValue: char ifAbsent: [])
> 					ifNil: [self nextPut: char]
> 					ifNotNil: [:escapeSequence |
> 						self
> 							nextPut: $&;
> 							nextPutAll: escapeSequence;
> 							nextPut: $;]]]].
>
> Tabs are expanded to four non-breaking spaces.
> How's that losing the indent.
>
>> So my way is no worse.  The current scheme throws away all indentation.
>
> No, see above.
>
>>  The current UI doesn't provide a way of setting paragraph indent.  So
>> we're in a situation where if one wants to indent we can only do so by
>> applying a <code></code> tag pair (and applying an invisible emphasis to a
>> text).  I think this is poor.  My simple approach doesn't lose indenting,
>> does mean that one can't use an initial paragraph indent, but does allow
>> one, easily, and visibly, to generate correctly indented HTML.
>>  I know what I want to chose right now.  You're forcing me to wait a long
>> time for the right solution.  I want to generate well-formatted blog posts
>> now.
>
> So, lets look: Object>>orderedCollection
>
> Old code/new code, yellow-click, copy as html:
> =======================================
> <b>asOrderedCollection</b><font color="#000000"><br>
>     </font><font color="#007F7F">"Answer an
> OrderedCollection with the receiver as its only element."</font><font
> color="#000000"><br>
> <br>
>     </font><font color="#7F0000">^</font><font
> color="#000000"> </font><font color="#000000">OrderedCollection</font><font
> color="#000000"> </font><font color="#00007F">with:</font><font
> color="#000000"> </font><font color="#7F0000">self</font>
> =======================================
> Observations:
> - colors preserved
> - indents preserved!
> - Reflows when window too small.
> - line breaks correctly honored
> - w/o styling, all serif.
>
>
> New code, select all, cmd-6/doit, yellow-click, copy as html:
> =======================================
> <code>
> <pre><b>asOrderedCollection</b><font color="#000000">
>     </font><font color="#007F7F">"Answer an
> OrderedCollection with the receiver as its only element."</font><font
> color="#000000">
>
>     </font><font color="#7F0000">^</font><font
> color="#000000"> OrderedCollection </font><font
> color="#00007F">with:</font><font color="#000000"> </font><font
> color="#7F0000">self</font></pre></code>
> =======================================
> Observations:
> - colors preserved
> - indents preserved!
> - keeps lines, no reflow when window too small.
> - line breaks correctly honored
> - w/o styling, all monospaced.
>
>
> inbox version, yellow-click, copy as html:
> =======================================
> <b>asOrderedCollection</b><font color="#000000"><br>
> </font><pre><font color="#000000">    </font><font
> color="#007F7F">"Answer an OrderedCollection with the receiver as its
> only element."</font><font color="#000000">
> </font></pre><font color="#000000"><br>
> </font><pre><font color="#000000">    </font><font
> color="#7F0000">^</font><font color="#000000"> </font><font
> color="#000000">OrderedCollection</font><font color="#000000"> </font><font
> color="#00007F">with:</font><font color="#000000"> </font><font
> color="#7F0000">self</font></pre>
> =======================================
> Observations:
> - colors preserved
> - indents preserved and explicitly colored?
> - keeps lines, no reflow when window too small.
> - line breaks incorrect, there's an additional space between comment and
> return?
> - first line styled different from rest of method?
>
>
> So what it does: wrap every _line_ with indent into a <pre>. I find that
> confusing.
> Also, mark-with-doit version is opt-in, inbox-verison is not.
>
> See also attached html and attached screenshot.
> I have included a comparison for the indented paragraph example, also.
>
> Best regards
> 	-Tobias
>


More information about the Squeak-dev mailing list