From d7b7b5ac7ef531559b76d952b3af5aa04b3db87a Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Mon, 16 Aug 2021 09:46:14 -0500 Subject: [PATCH] Improving links detection and tests. --- repository/TiddlyWiki/WikiText.class.st | 7 +++++++ repository/TiddlyWiki/WikiTextGrammar.class.st | 5 +++++ repository/TiddlyWiki/WikiTextGrammarTest.class.st | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/repository/TiddlyWiki/WikiText.class.st b/repository/TiddlyWiki/WikiText.class.st index d538f40..39c063a 100644 --- a/repository/TiddlyWiki/WikiText.class.st +++ b/repository/TiddlyWiki/WikiText.class.st @@ -43,3 +43,10 @@ WikiText >> convertMarkdownLinks [ ]. ^ self content ] + +{ #category : #accessing } +WikiText >> sample [ + ^ 'The ''quick'' brown ~~flea~~ fox //jumps// over the `lazy` dog. + + This is a link to HelloThere, and one to [[History of TiddlyWiki]] and [[other link]].' +] diff --git a/repository/TiddlyWiki/WikiTextGrammar.class.st b/repository/TiddlyWiki/WikiTextGrammar.class.st index f11b69d..b7a61fb 100644 --- a/repository/TiddlyWiki/WikiTextGrammar.class.st +++ b/repository/TiddlyWiki/WikiTextGrammar.class.st @@ -36,6 +36,11 @@ WikiTextGrammar >> linkOpen [ ^ '[[' asPParser ] +{ #category : #accessing } +WikiTextGrammar >> linkSea [ + ^ link sea ==> #second +] + { #category : #accessing } WikiTextGrammar >> start [ ^ document diff --git a/repository/TiddlyWiki/WikiTextGrammarTest.class.st b/repository/TiddlyWiki/WikiTextGrammarTest.class.st index 8f77ed0..9113c7b 100644 --- a/repository/TiddlyWiki/WikiTextGrammarTest.class.st +++ b/repository/TiddlyWiki/WikiTextGrammarTest.class.st @@ -9,6 +9,14 @@ WikiTextGrammarTest >> parserClass [ ^ WikiTextGrammar ] +{ #category : #accessing } +WikiTextGrammarTest >> testDocument [ + | input | + input := WikiText new sample. + self parse: input rule: #document. + self assert: result size equals: 2 +] + { #category : #accessing } WikiTextGrammarTest >> testLink [ self