Currently ΛNK produces code snippets with class selectors like:
<code class="language-kotlin:ank">
import arrow.*
import arrow.core.*
val throwsSomeStuff: (Int) -> Double = {x -> x.toDouble()}
val throwsOtherThings: (Double) -> String = {x -> x.toString()}
val moreThrowing: (String) -> List<String> = {x -> listOf(x)}
val magic = throwsSomeStuff.andThen(throwsOtherThings).andThen(moreThrowing)
magic
</code>
<code class="language-kotlin:ank:silent">
// Either Style
fun parse(s: String): Either<NumberFormatException, Int> =
if (s.matches(Regex("-?[0-9]+"))) Either.Right(s.toInt())
else Either.Left(NumberFormatException("$s is not a valid integer."))
fun reciprocal(i: Int): Either<IllegalArgumentException, Double> =
if (i == 0) Either.Left(IllegalArgumentException("Cannot take reciprocal of 0."))
else Either.Right(1.0 / i)
fun stringify(d: Double): String = d.toString()
fun magic(s: String): Either<Exception, String> =
parse(s).flatMap{reciprocal(it)}.map{stringify(it)}
</code>
Colon prefixed properties are pseudo-classes in W3C selector spec.
For a better intercommunication with other libraries, highlighters, document queries etc. would be better to have ΛNK to strip modifiers from final generated class names, unless those modifiers are intentionally trying to indicate something at the DOM level.
So having something like this fence:
```kotlin:ank:silent
class Contact(val id: Int, var email: String)
fun main(args: Array<String>) {
val contact = Contact(1, "mary@gmail.com")
println(contact.id)
}
The generated code block will be like this after ΛNK process it:
class Contact(val id: Int, var email: String)
fun main(args: Array<String>) {
val contact = Contact(1, "mary@gmail.com")
println(contact.id)
}
And finally, after Rouge (default Jekyll highlighter) process it, will get us to the following:
```kotlin
<pre>
<code class="language-kotlin">
class Contact(val id: Int, var email: String)
fun main(args: Array<String>) {
val contact = Contact(1, "mary@gmail.com")
println(contact.id)
}
</code>
</pre>
For reference, that is the behaviour tut applies, treating the modifier accordingly and then leaving the final language indicator as simply scala:
Currently ΛNK produces code snippets with class selectors like:
Colon prefixed properties are pseudo-classes in W3C selector spec.
For a better intercommunication with other libraries, highlighters, document queries etc. would be better to have ΛNK to strip modifiers from final generated class names, unless those modifiers are intentionally trying to indicate something at the DOM level.
So having something like this fence:
For reference, that is the behaviour
tut
applies, treating the modifier accordingly and then leaving the final language indicator as simplyscala
:http://tpolecat.github.io/tut/modifiers.html