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

Selection logic of writer in AbstractOutputDocument subclasses should be revisited #561

Open
Ducasse opened this issue Jul 1, 2022 · 0 comments

Comments

@Ducasse
Copy link
Contributor

Ducasse commented Jul 1, 2022

Currently in PRHtmlDocument defines

basicWriter
	
	^ (PRDocumentWriter allSubclasses detect: [ :each | 
		each isAbstract not
			and: [ each writerName = (project configuration propertyAt: #htmlWriter) ] ])
				new

as a consequence it is difficult to inject microdown writer

Now
PRPDFDocument is defining

basicWriter
	
	^ target writerFor: project configuration

This means that it takes the configuration information into account.

We should mix the two and that all the writers use the same logic as PRPDFDOcument
and fallback on the one of PRHtmlDocument.

Please note however that such inheritance tree registration mechanism is not that good because we
cannot inject microdown infrastructure.

In addition while introducing an explicit registration mechanism would be better, at the end there is a need to be able to select between a Pillar and Mic writer. So the previous suggestion may be a first step in that direction.

Note also that we already changed such aregistration logic for other registration for example of the input document and we did it as follows:

inputClassForFile: aFile
	"In the future classes should register explicitely and not be based on subclasses or implementator tricks."
	
	
	"^ self subclasses
		detect: [ :each | each doesHandleExtension: aFile extension ]
		ifNone: [ PRNoInputDocument  ]
		
	before microdown integration we only looked in the subclasses of PRInputDocument. 
	Now MicInputDocument is not a subclass of PRInputDocument for dependency reasons.
	It could be fixed with proper packaging."
	
	
	^ ((SystemNavigation default allImplementorsOf: #doesHandleExtension:) 
		collect: [ :each | each methodClass instanceSide ]) 
		detect: [ :each | each doesHandleExtension: aFile extension ]
		ifNone: [ PRNoInputDocument  ]

Now for the current problem the point is to find the object that will represent the difference between Microdown and Pillar syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant