Skip to content

Commit 1feb26f

Browse files
fix: drop fiddle_code (#2237)
* fix: drop fiddle_code * fix: fix indentation * fix: fix formatting * fix: fix failing pull request test
1 parent 4f2434b commit 1feb26f

File tree

7 files changed

+5
-29
lines changed

7 files changed

+5
-29
lines changed

actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/IntroSpec.scala

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@
1313

1414
package docs.org.apache.pekko.typed
1515

16-
//#fiddle_code
1716
//#imports
1817
import org.apache.pekko
1918
import pekko.actor.typed.scaladsl.Behaviors
2019
import pekko.actor.typed.scaladsl.LoggerOps
2120
import pekko.actor.typed.{ ActorRef, ActorSystem, Behavior }
2221
//#imports
23-
//#fiddle_code
2422

2523
import pekko.NotUsed
2624
import pekko.Done
@@ -35,17 +33,14 @@ import java.nio.charset.StandardCharsets
3533

3634
object IntroSpec {
3735
//format: OFF
38-
//#fiddle_code
39-
36+
4037
//#hello-world-actor
4138
object HelloWorld {
4239
final case class Greet(whom: String, replyTo: ActorRef[Greeted])
4340
final case class Greeted(whom: String, from: ActorRef[Greet])
4441

4542
def apply(): Behavior[Greet] = Behaviors.receive { (context, message) =>
46-
//#fiddle_code
4743
context.log.info("Hello {}!", message.whom)
48-
//#fiddle_code
4944
//#hello-world-actor
5045
println(s"Hello ${message.whom}!")
5146
//#hello-world-actor
@@ -65,9 +60,7 @@ object IntroSpec {
6560
private def bot(greetingCounter: Int, max: Int): Behavior[HelloWorld.Greeted] =
6661
Behaviors.receive { (context, message) =>
6762
val n = greetingCounter + 1
68-
//#fiddle_code
6963
context.log.info2("Greeting {} for {}", n, message.whom)
70-
//#fiddle_code
7164
//#hello-world-bot
7265
println(s"Greeting $n for ${message.whom}")
7366
//#hello-world-bot
@@ -111,7 +104,6 @@ object IntroSpec {
111104

112105
// Entry point for the execution
113106
HelloWorldMain.main(Array.empty)
114-
//#fiddle_code
115107
//format: ON
116108

117109
object CustomDispatchersExample {

actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/fromclassic/ClassicSample.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ object ClassicSample {
3737

3838
override def receive: Receive = {
3939
case Greet(whom) =>
40-
// #fiddle_code
4140
log.info("Hello {}!", whom)
4241
sender() ! Greeted(whom)
4342
}

docs/src/main/paradox/actors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ construction.
9797

9898
#### Here is another example:
9999

100-
@@snip [ActorDocSpec.scala](/docs/src/test/scala/docs/actor/ActorDocSpec.scala) { #fiddle_code template="Pekko" layout="v75" minheight="400px" }
100+
@@snip [ActorDocSpec.scala](/docs/src/test/scala/docs/actor/ActorDocSpec.scala) { #my-actor }
101101

102102
@@@
103103

docs/src/main/paradox/stream/stream-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ whether the stream terminated normally or exceptionally.
119119
<a name="here-is-another-example"></a>
120120
Here is another example:
121121

122-
@@snip [TwitterStreamQuickstartDocSpec.scala](/docs/src/test/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala) { #fiddle_code template=Pekko layout=v75 minheight=400px }
122+
@@snip [TwitterStreamQuickstartDocSpec.scala](/docs/src/test/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala) { #first-sample }
123123

124124

125125
## Reusable Pieces

docs/src/main/paradox/typed/actors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ You will also need to add a @ref:[logging dependency](logging.md) to see that ou
167167

168168
#### Here is another example:
169169

170-
@@snip [IntroSpec.scala](/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/IntroSpec.scala) { #fiddle_code template=Pekko layout=v75 minheight=400px }
170+
@@snip [IntroSpec.scala](/actor-typed-tests/src/test/scala/docs/org/apache/pekko/typed/IntroSpec.scala) { #hello-world-main }
171171

172172
@@@
173173

docs/src/test/scala/docs/actor/ActorDocSpec.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ final case class Give(thing: Any)
332332

333333
//#receive-orElse
334334

335-
//#fiddle_code
336335
import org.apache.pekko.actor.{ Actor, ActorRef, ActorSystem, PoisonPill, Props }
337336
import scala.concurrent.duration._
338337

@@ -364,8 +363,6 @@ class Ponger(pinger: ActorRef) extends Actor {
364363
}
365364
}
366365

367-
//#fiddle_code
368-
369366
//#immutable-message-definition
370367
case class User(name: String)
371368

@@ -409,7 +406,6 @@ class ActorDocSpec extends PekkoSpec("""
409406
}
410407

411408
"run basic Ping Pong" in {
412-
// #fiddle_code
413409
val system = ActorSystem("pingpong")
414410

415411
val pinger = system.actorOf(Props[Pinger](), "pinger")
@@ -421,8 +417,6 @@ class ActorDocSpec extends PekkoSpec("""
421417
ponger ! Ping
422418
}
423419

424-
// #fiddle_code
425-
426420
val testProbe = new TestProbe(system)
427421
testProbe.watch(pinger)
428422
testProbe.expectTerminated(pinger)

docs/src/test/scala/docs/stream/TwitterStreamQuickstartDocSpec.scala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import org.apache.pekko.testkit.PekkoSpec
2929
import scala.concurrent.ExecutionContext
3030

3131
object TwitterStreamQuickstartDocSpec {
32-
// #fiddle_code
3332
import org.apache.pekko
3433
import pekko.NotUsed
3534
import pekko.actor.ActorSystem
@@ -53,15 +52,12 @@ object TwitterStreamQuickstartDocSpec {
5352
val pekkoTag = Hashtag("#pekko")
5453
// #model
5554

56-
// #fiddle_code
57-
5855
abstract class TweetSourceDecl {
5956
// #tweet-source
6057
val tweets: Source[Tweet, NotUsed]
6158
// #tweet-source
6259
}
6360

64-
// #fiddle_code
6561
val tweets: Source[Tweet, NotUsed] = Source(
6662
Tweet(Author("rolandkuhn"), System.currentTimeMillis, "#pekko rocks!") ::
6763
Tweet(Author("patriknw"), System.currentTimeMillis, "#pekko !") ::
@@ -75,7 +71,6 @@ object TwitterStreamQuickstartDocSpec {
7571
Tweet(Author("drama"), System.currentTimeMillis, "we compared #apples to #oranges!") ::
7672
Nil)
7773

78-
// #fiddle_code
7974
}
8075

8176
class TwitterStreamQuickstartDocSpec extends PekkoSpec {
@@ -87,14 +82,12 @@ class TwitterStreamQuickstartDocSpec extends PekkoSpec {
8782
def println(s: Any): Unit = ()
8883

8984
trait Example1 {
90-
// #fiddle_code
9185
// #first-sample
9286
// #system-setup
9387
implicit val system: ActorSystem = ActorSystem("reactive-tweets")
9488
// #system-setup
9589
// #first-sample
9690

97-
// #fiddle_code
9891
}
9992

10093
"filter and map" in {
@@ -158,17 +151,15 @@ class TwitterStreamQuickstartDocSpec extends PekkoSpec {
158151
// format: ON
159152
}
160153

161-
"simple fiddle showcase" in {
154+
"simple example showcase" in {
162155

163-
// #fiddle_code
164156
tweets
165157
.filterNot(_.hashtags.contains(pekkoTag)) // Remove all tweets containing #pekko hashtag
166158
.map(_.hashtags) // Get all sets of hashtags ...
167159
.reduce(_ ++ _) // ... and reduce them to a single set, removing duplicates across all tweets
168160
.mapConcat(identity) // Flatten the set of hashtags to a stream of hashtags
169161
.map(_.name.toUpperCase) // Convert all hashtags to upper case
170162
.runWith(Sink.foreach(println)) // Attach the Flow to a Sink that will finally print the hashtags
171-
// #fiddle_code
172163
.value
173164
}
174165

0 commit comments

Comments
 (0)