<commit_before>Class {
	#name : #PRMorphWriter2,
	#superclass : #PRDocumentWriter,
	#category : #'Pillar-MorphicRenderer'
}

{ #category : #example }
PRMorphWriter2 class >> example [
	"self new example"
	<sampleInstance>
	
	| writer |
	writer := PRMorphWriter2 new
		visit: self exampleDocument.
	writer text asMorph openInWindow.
	^ writer
]

{ #category : #example }
PRMorphWriter2 class >> exampleDocument [
	
	^ PRPillarParser new parse: self pillarInputExample
]

{ #category : #testing }
PRMorphWriter2 class >> isAbstract [
	<ignoreForCoverage "This method is ignored for test coverage because it is overriden in all subclasses and these subclasses don't need to do a super-send.">
	^ false
]

{ #category : #example }
PRMorphWriter2 class >> pillarInputExample [
	^ '! Heading one 

!!Heading Twoo 

""this is bold""

this is not not bold 

this is a list
- item 1 ""this is bold again my friend""
- item 2

[[[language=smalltalk 
1 + 2 
]]]

! Heading one 

'
]

{ #category : #accessing }
PRMorphWriter2 class >> writerName [

	^ 'Morph'
]

{ #category : #accessing }
PRMorphWriter2 >> canvasClass [
	^ PRMorphCanvas
]

{ #category : #initialization }
PRMorphWriter2 >> initialize [
	super initialize.
	"stream := self defaultStream."
	"text := Text new."
]

{ #category : #accessing }
PRMorphWriter2 >> text [ 
	
	^ canvas text
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitBoldFormat: anObject [
	
	canvas append: anObject text asText allBold.	

	
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitCodeblock: aCodeBlock [ 
	
	| pillarText | 
	pillarText := aCodeBlock text asText.
	canvas append: 
		(pillarText addAttribute: (TextFontReference toFont: 
				(LogicalFont familyName: 'Bitmap DejaVu Sans' pointSize: 14)) from: 1 to: pillarText size).
]

{ #category : #visiting }
PRMorphWriter2 >> visitDocument: anObject [
	| numerator |
	numerator := (PRNumeratingVisitor new configuration: self configuration).
	numerator visit: anObject.
	super visitDocument: anObject. 
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitEmptyParagraph: anObject [

	canvas append: String crlf
]

{ #category : #visiting }
PRMorphWriter2 >> visitHeader: anObject [
	
	| level pillarText |
	self writeCounterForHeader: anObject.
	
	level := anObject level.
	pillarText := anObject text asText.
	canvas append: 
		(pillarText addAttribute: (TextFontReference toFont: 
				(LogicalFont familyName: 'Source Sans Pro' pointSize: ((5 - level) max: 1) * 8)) from: 1 to: anObject text size).
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitListItem: anObject [
	
	canvas append: Character tab.
	canvas append: '- '.
	self visitDocumentGroup: anObject.
	canvas append: String crlf
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitParagraph: anObject [

	super visitParagraph: anObject.
	canvas append: String crlf.
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitText: aText [
<commit_msg>introducing codefont<commit_after>Class {
	#name : #PRMorphWriter2,
	#superclass : #PRDocumentWriter,
	#instVars : [
		'codeFont'
	],
	#category : #'Pillar-MorphicRenderer'
}

{ #category : #example }
PRMorphWriter2 class >> example [
	"self new example"
	<sampleInstance>
	
	| writer |
	writer := PRMorphWriter2 new
		visit: self exampleDocument.
	writer text asMorph openInWindow.
	^ writer
]

{ #category : #example }
PRMorphWriter2 class >> exampleDocument [
	
	^ PRPillarParser new parse: self pillarInputExample
]

{ #category : #testing }
PRMorphWriter2 class >> isAbstract [
	<ignoreForCoverage "This method is ignored for test coverage because it is overriden in all subclasses and these subclasses don't need to do a super-send.">
	^ false
]

{ #category : #example }
PRMorphWriter2 class >> pillarInputExample [
	^ '! Heading one 

!!Heading Twoo 

""this is bold""

this is not not bold 

this is a list
- item 1 ""this is bold again my friend""
- item 2

[[[language=smalltalk 
1 + 2 
]]]

! Heading one 

'
]

{ #category : #accessing }
PRMorphWriter2 class >> writerName [

	^ 'Morph'
]

{ #category : #accessing }
PRMorphWriter2 >> canvasClass [
	^ PRMorphCanvas
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> codeFont [
	^ codeFont 
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> codeFont: aFont [
	codeFont := aFont
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> defaultCodeFont [
	^ (LogicalFont familyName: 'Bitmap DejaVu Sans' pointSize: 14)
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> initialize [
	super initialize.
	codeFont := self defaultCodeFont 
]

{ #category : #accessing }
PRMorphWriter2 >> text [ 
	
	^ canvas text
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitBoldFormat: anObject [
	
	canvas append: anObject text asText allBold

	
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitCodeblock: aCodeBlock [ 
	
	| pillarText | 
	pillarText := aCodeBlock text asText.
	canvas append: 
		(pillarText addAttribute: (TextFontReference toFont: codeFont) from: 1 to: pillarText size)
]

{ #category : #visiting }
PRMorphWriter2 >> visitDocument: anObject [
	| numerator |
	numerator := (PRNumeratingVisitor new configuration: self configuration).
	numerator visit: anObject.
	super visitDocument: anObject. 
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitEmptyParagraph: anObject [

	canvas append: String crlf
]

{ #category : #visiting }
PRMorphWriter2 >> visitHeader: anObject [
	
	| level pillarText |
	self writeCounterForHeader: anObject.
	
	level := anObject level.
	pillarText := anObject text asText.
	canvas append: 
		(pillarText addAttribute: (TextFontReference toFont: 
				(LogicalFont familyName: 'Source Sans Pro' pointSize: ((5 - level) max: 1) * 8)) from: 1 to: anObject text size).
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitListItem: anObject [
	
	canvas append: Character tab.
	canvas append: '- '.
	self visitDocumentGroup: anObject.
	canvas append: String crlf
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitParagraph: anObject [

	super visitParagraph: anObject.
	canvas append: String crlf
]

{ #category : #'visiting-document' }
PRMorphWriter2 >> visitText: aText [

{'fraction_non_alphanumeric': 0.11395461129888942, 'fraction_numerical': 0.009818123289876066, 'mean_word_length': 4.398783666377064, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4147360', 'n_tokens_mistral': 2187, 'n_tokens_neox': 2057, 'n_words': 565}