Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert classic figure scripts #136

Merged
merged 4 commits into from
Sep 28, 2022
Merged

Convert classic figure scripts #136

merged 4 commits into from
Sep 28, 2022

Conversation

LinqLover
Copy link
Collaborator

@LinqLover LinqLover commented Sep 28, 2022

  • convert classic figure scripts (%%) to modern \ExecuteSmalltalkScripts (2ef83d1)

    This did it:

    | matcher files |
    matcher := '%%\{(SBESqueakPicture)(([^\r\n]*([\r\n]|\r\n))%%)*(])\}' asRegex.
    files := SBEScriptBuilder getTexFilesIn: SBEScriptBuilder resourceDirectory.
    files
    	collect: [:file | file -> (SBEScriptBuilder collectScriptsFromFile: file)]
    	as: Dictionary.
    files do: [:file |
    	file writeStreamDo: [:stream | | translated |
    		translated := matcher copy: file contents translatingMatchesUsing: [:s | '\begin{ExecuteSmalltalkScript}' , (matcher subexpression: 5) , (((matcher subexpressions: 2) , (matcher subexpressions: 4) , (matcher subexpressions: 6)) join) , (matcher subexpression: 5) , '\end{ExecuteSmalltalkScript}'].
    		stream reset; nextPutAll: translated]]
  • Migrate all senders of SBESqueakPicture to SBEScreenshotRecorder (716c259)

    Regex:

    SBESqueakPicture( writeTo: .* (frame: .* ))using:(?= \[)

    ->

    SBEScreenshotRecorder$1building:
    
  • extract: remove deprecated code (SBESqueakPicture, #collectScriptsClassicFromStream:) (6ae87c2)

This did it:

	| matcher files |
	matcher := '%%\{(SBESqueakPicture)(([^\r\n]*([\r\n]|\r\n))%%)*(])\}' asRegex.
	files := SBEScriptBuilder getTexFilesIn: SBEScriptBuilder resourceDirectory.
	files
		collect: [:file | file -> (SBEScriptBuilder collectScriptsFromFile: file)]
		as: Dictionary.
	files do: [:file |
		file writeStreamDo: [:stream | | translated |
			translated := matcher copy: file contents translatingMatchesUsing: [:s | '\begin{ExecuteSmalltalkScript}' , (matcher subexpression: 5) , (((matcher subexpressions: 2) , (matcher subexpressions: 4) , (matcher subexpressions: 6)) join) , (matcher subexpression: 5) , '\end{ExecuteSmalltalkScript}'].
			stream reset; nextPutAll: translated]]
Regex:
    SBESqueakPicture( writeTo: .* (frame: .* ))using:(?= \[)
->
    SBEScreenshotRecorder$1building:
@LinqLover LinqLover self-assigned this Sep 28, 2022
@LinqLover LinqLover marked this pull request as ready for review September 28, 2022 14:57
@LinqLover LinqLover enabled auto-merge (squash) September 28, 2022 14:57
@LinqLover LinqLover merged commit 2b39761 into master Sep 28, 2022
@LinqLover LinqLover deleted the convert-classic-scripts branch September 28, 2022 15:05
@LinqLover LinqLover mentioned this pull request Jun 27, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant