Created
January 27, 2014 14:13
-
-
Save jducoeur/8649229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override def qlApply(inv:Invocation):QValue = { | |
for ( | |
pt <- inv.contextTypeAs[URLableType]; | |
// Problem 1: List | |
elemContext <- inv.contextElements; | |
// Problem 2: Option | |
elemV <- elemContext.value.firstOpt; | |
// Problem 3: another Option | |
url <- pt.getURL(elemContext)(elemV); | |
paramVal <- inv.processParam(0, elemContext); | |
label = paramVal.wikify(elemContext); | |
wikitext = QWikitext("[") + label + QWikitext(s"]($url)") | |
) | |
yield QValue.make(ExactlyOne, ParsedTextType, wikitext) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment