Skip to content

Commit efeeea5

Browse files
committed
Merge 1ed589c
2 parents 289db39 + 1ed589c commit efeeea5

File tree

63 files changed

+1435
-900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1435
-900
lines changed

.github/scripts/preLoading.st

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
"IceRepository registry
2-
detect: [ :each | #('Microdown' 'NewTools-DocumentationReader') includes: each name ]
3-
ifFound: [ :aRepository | aRepository forget ].
4-
#( 'BaselineOfMicrodownDev' 'BaselineOfMicrodown' 'Microdown' 'Microdown-Tests' 'Microdown-MicrodownRichTextComposer' 'Microdown-ResolvePath'
5-
'Microdown-ResolvePath-Tests' 'NewTools-DocumentationReader-Tests' 'BaselineOfNewToolsDocumentationReader' 'Microdown-RichTextComposer' 'Spec2-Microdown'
6-
'NewTools-DocumentationReader' 'BaselineOfBeautifulComments' 'BeautifulComments') do: [ :each |
7-
(RPackageOrganizer default packageNamed: each ifAbsent: [ nil ])
8-
ifNotNil: [ :aPackage | aPackage removeFromSystem ] ]"
91

102
#( 'Microdown' 'BeautifulComments' 'DocumentBrowser' ) do: [ :name |
113
(IceRepository repositoryNamed: name)

.github/workflows/tests-all.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ env:
66

77
on:
88
push:
9-
branches: [ Pharo12 ]
9+
branches: [ Pharo13 ]
1010
pull_request:
11-
branches: [ Pharo12 ]
11+
branches: [ Pharo13 ]
1212

1313
# Allows you to run this workflow manually from the Actions tab
1414
workflow_dispatch:
@@ -19,11 +19,13 @@ jobs:
1919
strategy:
2020
matrix:
2121
os: [ ubuntu-latest ]
22-
smalltalk: [ Pharo64-12 ]
22+
smalltalk: [ Pharo64-alpha ]
2323
runs-on: ${{ matrix.os }}
2424
name: ${{ matrix.smalltalk }} on ${{ matrix.os }}
2525
steps:
2626
- uses: actions/checkout@v3
27+
with:
28+
fetch-depth: '0'
2729
- name: Setup smalltalkCI
2830
uses: hpi-swa/setup-smalltalkCI@v1
2931
with:

.github/workflows/tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ jobs:
2222
runs-on: ${{ matrix.platform }}
2323
steps:
2424
- uses: actions/checkout@v3
25+
with:
26+
fetch-depth: '0'
2527
- uses: hpi-swa/setup-smalltalkCI@v1
2628
id: smalltalkci
2729
with:
28-
smalltalk-image: Pharo64-12
30+
smalltalk-image: Pharo64-alpha
2931
- run: smalltalkci -s ${{ steps.smalltalkci.outputs.smalltalk-image }}
3032
shell: bash
3133
timeout-minutes: 15

doc/api.md

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,111 @@
1-
# Microdown APIThere is a lot of functionality in Microdown, and this document gives an overview of the Microdown architecture.- Architecture - key objects in Microdown- Microdown facade methods- Resource references and resolvers. Dealing with links, images, and included documentsSeveral parts of Microdown allows for extending the Microdown tool suite. [Extension has is own documentation page](extension.md).The full suite of microdown tools are not loaded by default. In particular there is also support for - Translation of Microdown to Latex and Beamer- Translation of Microdown to HTML- Translation from Pillar to Microdown- Misc other tools## ArchitectureThe overall idea in Microdown is like this:![](https://www.planttext.com/api/plantuml/png/VP1D2u9048Rl-oi6xq9q35c4EdHG2fJkYmwofBioEqj2zDzJAoNxcECy3xmlR-nO4Vkc5iATjMaLgGO82rQcgX6k0leZwqsvjMIGOBqIDo5c8qXrGRQq5nF0IvzWPZqL256KCMbJIGaBOMSBtw3XNia9KSe5px4RsC5pw_c39egn-uttUPeiwRDH6CevUmD7HGvf5ARle8pn6pXffzb-uOy2VuInmZiVvelHbFtcTm00)$$%commentYou can edit the figure using this source on planttext.com @startumlskinparam rectangle { roundCorner 20}rectangle "Microdown" { rectangle Source <<String>> rectangle Document <<Tree>> rectangle Text <<Output>> rectangle Latex <<Output>> rectangle HTML <<Output>> Source --> Document : Parser Document --> Text : Visitor Document --> Latex : Visitor Document --> HTML : Visitor }@enduml $$The format of the source code is explained in the [section on syntax](syntax.md).The parser translates the source code into an abstract syntax tree which we refer to as a "document". Translation into various output formats are done using visitors. By default only the visitor for translation into pharo `Text` is in the image. Sometimes `Text` is refered to as `RichText` to emphasize its difference from plain character `String`.## Microdown facade### Parse and output generationThe class `Microdown` has facade methods for the main actions in the architecture.- `Microdown class >> #parse:` translates a microdown source string into a document.- `Microdown class >> #asRichText:` translates a document into rich text. `asRichText:` can also accept a source string directly, cirumventing the `parse:` method. There are two facade methods for _resolution_. - `Microdown class >> #resolveDocument:withBase:` and - `Microdown class >> #resolveString:withBase:`The will be explained in the next section ## Resolution and referencesReferences to other documents or images can be either _absolute_ or _relative_. A typical absolute reference is `[Pharo](https:pharo.org)` or `![](file:/path/to/image.png)`. Absolute references cause no problems for the visitors to find the image or follow the link.However, when writing larger documents it is customary to keep images for the document in a seperate image folder, and refer to the images as `![](img/figure2.png)`. Such a reference is _relative_. It is relative to to location of the document containing the reference.**Resolution** is the process of replacing all relative references with absolute references. This process takes two inputs:- A document D containing relative references- The absolute location of document D (the base of the document).The two methods - `Microdown class >> #resolveDocument:withBase:` and - `Microdown class >> #resolveString:withBase:`are the prefered way to resolve documents.### Resource referencesIf we go one level below this, references are first order objects, all subclasses of `MicResourceReference`.In the standard image there are three kinds of absolute references:- http (and https) - for example: 'https://pharo.org/web/files/pharo.png'- file - for example 'file:/user/joe/docs/api.md'- the pharo image - for example 'pharo:///Object/iconNamed:/thumbsUp' (![](pharo:///Object/iconNamed:/thumbsUp))#### Creating referencesThe prefered way is to use the extension method `asMicResourceReference`, which is defined for- String - for example `'file:/user/joe/docs/api.md' asMicResourceReference`- ZnUrl - for example `(ZnUri fromString: 'https://pharo.org/web/files/pharo.png') asMicResourceReference`- FileReference - for example `(FileSystem memory) asMicResourceReference`#### Using referencesThere are two main key methods on references:- `loadImage` - returns a `Form` by reading the image (read using `ImageReadWriter class >> #formFromStream:`)- `loadMicrodown` - loads _and resolves_ a document#### BackgroundThe resolution is done using `ZnUrl >> #withRelativeReference:`, which implements the full resolution standard [RFC 3986 Section 5](https://datatracker.ietf.org/doc/html/rfc3986#section-5).##### Ambiguity of file uriIn pharo there is an issue that uri ' file://path/to/my/document.md' is ambiguous, because it can not be determined in which file system the path is supposed to be resolved (memory or disk). This problem is dealt with, in the following manner:- `' file://path/to/my/document.md' asMicResourceReference` will always use the disk file system- `aFileReference asMicResourceReference` will create a `MicFileResourceReference` which remembers the file system in the file reference.- `aMicFileResourceReference loadDocument` will use the right filesystem for resolution.
1+
# Microdown API
2+
3+
There is a lot of functionality in Microdown, and this document gives an overview of the Microdown architecture.
4+
5+
- Architecture - key objects in Microdown.
6+
- Microdown facade methods.
7+
- Resource references and resolvers. Dealing with links, images, and included documents.
8+
- Document checkers: Microdown provides checkers that validate documents.
9+
10+
Several parts of Microdown allows for extending the Microdown tool suite. Chapter *@[Extension](extension.md)@* presents the mechanisms in place.
11+
12+
The full suite of microdown tools are not loaded by default. In particular there is also support for:
13+
- Translation of Microdown to Latex and Beamer,
14+
- Translation of Microdown to HTML,
15+
- Translation from Pillar to Microdown, and
16+
- Document checkers.
17+
18+
## Architecture
19+
The overall idea in Microdown is like this:
20+
21+
![](https://www.planttext.com/api/plantuml/png/VP1D2u9048Rl-oi6xq9q35c4EdHG2fJkYmwofBioEqj2zDzJAoNxcECy3xmlR-nO4Vkc5iATjMaLgGO82rQcgX6k0leZwqsvjMIGOBqIDo5c8qXrGRQq5nF0IvzWPZqL256KCMbJIGaBOMSBtw3XNia9KSe5px4RsC5pw_c39egn-uttUPeiwRDH6CevUmD7HGvf5ARle8pn6pXffzb-uOy2VuInmZiVvelHbFtcTm00)
22+
23+
You can edit the figure using this source on planttext.com
24+
```
25+
@startuml
26+
skinparam rectangle {
27+
roundCorner 20
28+
}
29+
rectangle "Microdown" {
30+
rectangle Source <<String>>
31+
rectangle Document <<Tree>>
32+
rectangle Text <<Output>>
33+
rectangle Latex <<Output>>
34+
rectangle HTML <<Output>>
35+
Source --> Document : Parser
36+
Document --> Text : Visitor
37+
Document --> Latex : Visitor
38+
Document --> HTML : Visitor
39+
}
40+
@enduml
41+
```
42+
43+
The format of the source code is explained in the Chapter *@[Syntax](syntax.md)@*.
44+
45+
The parser translates the source code into an abstract syntax tree which we refer to as a "document". Translation into various output formats are done using visitors. By default only the visitor for translation into Pharo `Text` objects is in the image. Sometimes `Text` is refered to as `RichText` to emphasize its difference from plain character `String`.
46+
47+
48+
## Microdown facade
49+
### Parse and output generation
50+
The class `Microdown` has facade methods for the main actions in the architecture.
51+
52+
- `Microdown class >> #parse:` translates a microdown source string into a document.
53+
- `Microdown class >> #asRichText:` translates a document into rich text. `asRichText:` can also accept a source string directly, cirumventing the `parse:` method.
54+
55+
There are two facade methods for _resolution_.
56+
- `Microdown class >> #resolveDocument:withBase:` and
57+
- `Microdown class >> #resolveString:withBase:`
58+
59+
The will be explained in the next section.
60+
61+
## Resolution and references
62+
63+
References to other documents or images can be either _absolute_ or _relative_.
64+
65+
#### Absolute vs. relative references.
66+
67+
A typical absolute reference is `[Pharo](https:pharo.org)` or `![](file:/path/to/image.png)`. Absolute references cause no problems for the visitors to find the image or follow the link.
68+
However, when writing larger documents it is customary to keep images for the document in a seperate image folder, and refer to the images as `![](img/figure2.png)`. Such a reference is _relative_. It is relative to to location of the document containing the reference.
69+
70+
**Resolution** is the process of replacing all relative references with absolute references. This process takes two inputs:
71+
- A document D containing relative references and
72+
- The absolute location of document D (the base of the document).
73+
74+
The two methods
75+
- `Microdown class >> #resolveDocument:withBase:` and
76+
- `Microdown class >> #resolveString:withBase:`
77+
are the prefered way to resolve documents.
78+
79+
### Resource references
80+
81+
If we go one level below this, references are first order objects, all subclasses of `MicResourceReference`.
82+
83+
In the standard image there are three kinds of absolute references:
84+
- http (and https) - for example: 'https://pharo.org/web/files/pharo.png'
85+
- file - for example 'file:/user/joe/docs/api.md'
86+
- the pharo image - for example 'pharo:///Object/iconNamed:/thumbsUp' `(![](pharo:///Object/iconNamed:/thumbsUp))`
87+
-
88+
#### Creating references
89+
90+
The prefered way is to use the extension method `asMicResourceReference`, which is defined for
91+
- String - for example `'file:/user/joe/docs/api.md' asMicResourceReference`
92+
- ZnUrl - for example `(ZnUri fromString: 'https://pharo.org/web/files/pharo.png') asMicResourceReference`
93+
- FileReference - for example `(FileSystem memory) asMicResourceReference`
94+
95+
#### Using references
96+
97+
There are two main key methods on references:
98+
- `loadImage` - returns a `Form` by reading the image (read using `ImageReadWriter class >> #formFromStream:`)
99+
- `loadMicrodown` - loads _and resolves_ a document
100+
101+
#### Background
102+
103+
The resolution is done using `ZnUrl >> #withRelativeReference:`, which implements the full resolution standard [RFC 3986 Section 5](https://datatracker.ietf.org/doc/html/rfc3986#section-5).
104+
105+
##### Ambiguity of file uri
106+
107+
In pharo there is an issue that uri ' file://path/to/my/document.md' is ambiguous, because it can not be determined in which file system the path is supposed to be resolved (memory or disk). This problem is dealt with, in the following manner:
108+
- `' file://path/to/my/document.md' asMicResourceReference` will always use the disk file system
109+
- `aFileReference asMicResourceReference` will create a `MicFileResourceReference` which remembers the file system in the file reference.
110+
- `aMicFileResourceReference loadDocument` will use the right filesystem for resolution.
111+

0 commit comments

Comments
 (0)