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

Merge dev into Pharo 13 #932

Merged
merged 13 commits into from
Feb 18, 2025
Prev Previous commit
Next Next commit
Adding a way to skip metadata
  • Loading branch information
Ducasse committed Feb 13, 2025
commit 1e8e02645c90fd08a8d2492d160837d09a5f9bbc
15 changes: 15 additions & 0 deletions src/Microdown-HTMLExporter-Tests/MicHTMLExporterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ MicHTMLExporterTest class >> testParameters [

{ #category : 'accessing' }
MicHTMLExporterTest >> factory: aFactory [
self flag: #todo.
"This is horrible either factory: should be renamed factoryClass or we should remove the new."
factory := aFactory new
]

Expand Down Expand Up @@ -200,6 +202,19 @@ MicHTMLExporterTest >> testHeaderLevel2 [
andCheckWeGet: newLine , '<h2>Foo</h2>'
]

{ #category : 'tests - metadata' }
MicHTMLExporterTest >> testMetaDataIsIgnored [

self parse: factory metaDataSample andCheckWeGet: ''
]

{ #category : 'tests - metadata' }
MicHTMLExporterTest >> testMetaDataIsNotIgnored [

writer doNotIgnoreMetaData.
self parse: factory metaDataSample andCheckWeGet: ''
]

{ #category : 'tests - paragraph' }
MicHTMLExporterTest >> testParagraph [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ MicHTMLVisitorTest >> testCanvasClass [
self assert: writer canvasClass equals: MicHTMLCanvas
]

{ #category : 'test' }
{ #category : 'tests' }
MicHTMLVisitorTest >> testConfiguration [

self assert: (writer configuration isKindOf: MicHTMLConfiguration).
Expand Down
32 changes: 27 additions & 5 deletions src/Microdown-HTMLExporter/MicHTMLVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Class {
#superclass : 'MicrodownVisitor',
#instVars : [
'canvas',
'configuration'
'configuration',
'ignoresMetaData'
],
#category : 'Microdown-HTMLExporter-Visitor',
#package : 'Microdown-HTMLExporter',
Expand Down Expand Up @@ -158,13 +159,25 @@ MicHTMLVisitor >> crlfAsNewLine [
canvas crlfAsNewLine
]

{ #category : 'as yet unclassified' }
MicHTMLVisitor >> doNotIgnoreMetaData [
ignoresMetaData := false
]

{ #category : 'accessing' }
MicHTMLVisitor >> ignoreMetaData [
ignoresMetaData := true
]

{ #category : 'initialization' }
MicHTMLVisitor >> initialize [
MicHTMLVisitor >> initialize [

| stream |
super initialize.
stream := MicOutputStream new setStream: (WriteStream on: String empty).
stream := MicOutputStream new setStream:
(WriteStream on: String empty).
canvas := self canvasClass on: stream.

ignoresMetaData := true.
]

{ #category : 'initialization' }
Expand All @@ -188,6 +201,14 @@ MicHTMLVisitor >> minQuoteThreshold [
^ 50
]

{ #category : 'initialization' }
MicHTMLVisitor >> stream: aStream [

| stream |
stream := MicOutputStream new setStream: aStream.
canvas := self canvasClass on: stream
]

{ #category : 'initialization' }
MicHTMLVisitor >> usedNewLine [
"Return the encoded new line. Useful for tests."
Expand Down Expand Up @@ -396,8 +417,9 @@ MicHTMLVisitor >> visitMath: anObject [
{ #category : 'visiting' }
MicHTMLVisitor >> visitMetaData: aMetaData [

ignoresMetaData ifTrue: [
self metaDataFromAssociations: aMetaData body.
super visitMetaData: aMetaData.
super visitMetaData: aMetaData ]
]

{ #category : 'visiting - inline elements' }
Expand Down
Loading