Skip to content

Commit

Permalink
better class comment + key as subclassresponsibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Oct 19, 2024
1 parent 40375d6 commit 3fde7ec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/Microdown/MicAnnotationBlock.class.st
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
"
I represent an annotation, a tag with parameters, delimited by `{!` and `!}`.
I'm composed of a tag and a list of valued keys following the syntax `tag|key1=value1&key2=value2`

The following example is a citation annotation with the name variable bound to the string 'Duca99a' as a parameter.

```text
{!citation|name=Duca99a!}
{!citation|ref=Duca99a!}
```

```
MicrodownParser parse: '{!citation|name=Duca99a!}'
MicrodownParser parse: '{!citation|ref=Duca99a!}'
```

Note that the first key (that should be defined on the class side via the key method) can be omitted.
So

```text
{!citation|ref=Duca99a!}
```

is equivalent to

```text
{!citation|Duca99a!}
```
"
Class {
Expand Down Expand Up @@ -64,6 +78,13 @@ MicAnnotationBlock class >> parse: delimiter stream: aTokenStream for: aParser [
arguments: arguments
]

{ #category : 'parsing' }
MicAnnotationBlock class >> tag [
"Return the identifier of annotation e.g. tag in tag|key=value"

^ self subclassResponsibility
]

{ #category : 'visiting' }
MicAnnotationBlock >> accept: aVisitor [
^ aVisitor visitAnnotation: self
Expand Down
2 changes: 2 additions & 0 deletions src/Microdown/MicCitationBlock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Class {

{ #category : 'accessing' }
MicCitationBlock class >> key [
"The key for citation|ref=Value is ref"

^ 'ref'
]

Expand Down

0 comments on commit 3fde7ec

Please sign in to comment.