The Trunk: Help-Squeak-Project-ct.106.mcz
[email protected] Mon, 27 Jul 2026 07:33:21 0000
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <[email protected]> |
Marcel Taeumel uploaded a new version of Help-Squeak-Project to project The Trunk:
http://source.squeak.org/trunk/Help-Squeak-Project-ct.106.mcz
==================== Summary ====================
Name: Help-Squeak-Project-ct.106
Author: ct
Time: 12 July 2026, 3:28:57.102808 am
UUID: ff70a37c-19c5-44e5-bef3-4589760e5108
Ancestors: Help-Squeak-Project-ct.105
Improvements for jekyll storing of release notes:
- Export do-it attributes like code:// URLs
- Export text kerns as <code> tags
- Properly handle nested bullet points indented with tabs
- Ensure line break after bullet point (Markdown requires an empty line before the next line)
- Escape line breaks in multi-line code statements
=============== Diff against Help-Squeak-Project-ct.105 ===============
Item was changed:
----- Method: SqueakReleaseNotes class>>jekyllTextFor: (in category 'storing') -----
jekyllTextFor: aText
| text |
text := aText.
"1) escape markdown characters"
text := Text new: text size streamContents: [:stream |
| nextIndex lastIndex |
nextIndex := 0.
[(nextIndex := text indexOfAnyOf: '#*_`|\' startingAt: (lastIndex := nextIndex + 1)) > 0] whileTrue:
[| attributes |
stream nextPutAll: (text copyFrom: lastIndex to: nextIndex - 1).
attributes := text attributesAt: nextIndex.
stream withAttributes: attributes do:
+ [(attributes anySatisfy: [:attr | attr isTextFontChange or: [attr isKindOf: TextColor] or: [attr isKindOf: TextKern orOf: TextPrintIt]]) "non-markdownish HTML tags such as <font> or <code> treat their contents as pure HTML and do not need/tolerate Markdown escapes"
- [(attributes anySatisfy: [:attr | attr isTextFontChange or: [attr isKindOf: TextColor]]) "non-markdownish HTML tags such as <font> treat their contents as pure HTML and do not need/tolerate Markdown escapes"
ifFalse: [stream nextPut: $\].
stream nextPut: (text at: nextIndex)]].
stream nextPutAll: (text allButFirst: lastIndex - 1)].
"2) ensure linebreaks"
text := Text new: text size streamContents: [:stream |
+ | lines line isBullet |
- | lines line |
lines := text lines.
line := lines at: 1 ifAbsent: [nil].
+ line ifNotNil:
+ [isBullet := line withBlanksTrimmed beginsWithAnyOf: #('-' '*')].
+ 2 to: lines size do: [:index | | nextLine nextIsBullet |
+ "before bullet points, replace any tab indentation with spaces to prevent them from being rendering as nbsps for html, which jekyll cannot handle for bullet points"
+ isBullet ifTrue:
+ [[line first = Character tab] whileTrue:
+ [stream nextPutAll: ' '.
+ line := line allButFirst]].
- 2 to: lines size do: [:index |
stream nextPutAll: line.
+ nextLine := lines at: index.
+ nextIsBullet := nextLine withBlanksTrimmed beginsWithAnyOf: #('-' '*').
+ (line isEmpty or: [nextLine isEmpty] or: [nextIsBullet])
- (line isEmpty | (line := lines at: index) isEmpty or: [line withBlanksTrimmed beginsWithAnyOf: #('-' '*')])
ifFalse: [stream nextPutAll: ' '].
+ stream cr.
+ (isBullet and: [nextLine notEmpty and: [nextIsBullet not]])
+ ifTrue: [stream cr].
+ line := nextLine.
+ isBullet := nextIsBullet].
- stream cr].
lines atLast: 1 ifPresent: [:lastLine |
stream nextPutAll: lastLine; cr]].
"3) prepare links for HTML"
text replaceAttributesThat: [:attr | attr isKindOf: TextLink] by: [:attr |
TextURL url: ('code://TextLink new classAndMethod: {1}; actOnClickFor: Model new' format: {attr classAndMethod storeString})].
+ text replaceAttributesThat: [:attr | attr isKindOf: TextDoIt] by: [:attr :start :stop |
+ TextURL url: ('code://(TextDoIt evalString: {1}) actOnClickFor: Model new' format: {attr evalString storeString})].
+ text replaceAttributesThat: [:attr | attr isKindOf: TextKern] by: [:attr :start :stop |
+ TextPrintIt new analyze: (text copyFrom: start to: stop); yourself].
^ text!
Item was changed:
----- Method: SqueakReleaseNotes class>>store:asJekyllOn: (in category 'storing') -----
store: subtopic asJekyllOn: aStream
"Generate a Markdown-compatible version of the release notes for https://squeak.org/release_notes/."
+ | version text html |
- | version text |
version := subtopic title asString.
(aStream respondsTo: #lineEndConvention:) ifTrue:
[aStream lineEndConvention: #lf].
aStream nextPutAll:
(
'---
title: Squeak {1} Release Notes
order: {2}
permalink: /release_notes/{1}/
rewrite_code_links: true
# This file was automatically generated. Edit it using:
# {3} edit: {4}.
# {3} storeKey: {4} asJekyllFileInDirectoryNamed: ''_release_notes''.
---
'
format: {version. (version asNumber asScaledDecimal * 100) rounded. self name. subtopic key storeString}).
text := self jekyllTextFor: subtopic contents.
+ html := String streamContents: [:stream |
+ text printHtmlOn: stream breakLines: false].
+
+ "Escape line breaks in multi-line code statements (that is, inside quoted HTML attribute values)"
+ "html := html copyWithRegex: '(?<=(?<!![\s\S])([^<]*(<[^>]*>[^<]*)*<[^>]*\=""[^""]*))[\r\n]' matchesReplacedWith: ' '." self flag: #workaround. "regex bug https://github.com/squeak-smalltalk/squeak-object-memory/issues/159"
+ html := String streamContents: [:out |
+ | state quote |
+ state := #text.
+ quote := nil.
+ html do: [:char |
+ ((String crlf includes: char) and: [state = #attributeValue])
+ ifTrue: [out nextPutAll: ' ']
+ ifFalse: [out nextPut: char].
+
+ state := (state caseOf:
+ {[#text] ->
+ [char = $<
+ ifTrue: [#tag]].
+ [#tag] ->
+ [char
+ caseOf:
+ {[$>] -> [#text].
+ [$=] -> [#afterEquals]}
+ otherwise: []].
+ [#afterEquals] ->
+ [char isSeparator
+ ifFalse:
+ [char = $"
+ ifTrue:
+ [quote := char.
+ #attributeValue]
+ ifFalse:
+ [char = $>
+ ifTrue: [#text]
+ ifFalse: [#tag]]]].
+ [#attributeValue] ->
+ [char = quote
+ ifTrue:
+ [quote := nil.
+ #tag]]})
+ ifNil: [state]]].
+ aStream nextPutAll: html.!
- text printHtmlOn: aStream breakLines: false.!
Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]