Skip to content

Commit cc4ea0a

Browse files
committed
update
1 parent 60f81ae commit cc4ea0a

7 files changed

Lines changed: 82 additions & 60 deletions

File tree

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
export BOOKDIR=$(HOME)/Runestone/books/thinkcspy
22
export COMPDIR=$(HOME)/Runestone/RunestoneComponents
3+
export RSURI = https://runestone.academy/cdn/runestone/
34

45
.PHONY: pretext html pdf
56

7+
help:
8+
@echo "Unless you are converting RST to PTX you you should use this Makefile!!!!"
9+
@echo "Use pip to install pretextbook"
10+
@echo "To build run: pretext build --input pretext/thinkcspy.ptx --output output --format html --publication pretext/publication-rs-for-all.xml"
11+
@echo "Then: pretext view html"
12+
613
# This target converts the RST to Generic XML
714
xml:
815
runestone rs2ptx
@@ -11,17 +18,17 @@ xml:
1118
# working ptx as possible.
1219
pretext:
1320
python ~/Runestone/Runestone2PreTeXt/xml2ptx.py
14-
# python ~/Runestone/Runestone2PreTeXt/fixFileNames.py
1521
python ~/Runestone/Runestone2PreTeXt/fixIds.py
22+
python ~/Runestone/Runestone2PreTeXt/fix_xrefs.py
23+
python ~/Runestone/Runestone2PreTeXt/reformatPtx.py
1624

1725
# Convert the ptx to html and make sure that the latest Javascript/css bundles are in place
1826
html:
19-
python $(COMPDIR)/scripts/dist2xml.py test
20-
python ~/src/pretext/pretext/pretext -c all -f html -p $(BOOKDIR)/pretext/publication-rs-for-all.xml -x debug.rs.services.file /Users/bmiller/Runestone/RunestoneComponents/runestone/dist/webpack_static_imports.xml -d $(BOOKDIR)/beta $(BOOKDIR)/pretext/thinkcspy.ptx
27+
python $(COMPDIR)/scripts/dist2xml.py test $(https://runestone.academy/cdn/runestone/)
28+
# python ~/src/pretext/pretext/pretext -c all -f html -p $(BOOKDIR)/pretext/publication-rs-for-all.xml -x debug.rs.services.file /Users/bmiller/Runestone/RunestoneComponents/runestone/dist/webpack_static_imports.xml -d $(BOOKDIR)/beta $(BOOKDIR)/pretext/thinkcspy.ptx
29+
python ~/src/pretext/pretext/pretext -c all -f html -p $(BOOKDIR)/pretext/publication-rs-for-all.xml -d $(BOOKDIR)/beta $(BOOKDIR)/pretext/thinkcspy.ptx
2130
rsync -avz $(COMPDIR)/runestone/dist/ $(BOOKDIR)/beta/_static/test/
2231

2332
pdf:
2433
python ~/src/pretext/pretext/pretext -c all -f pdf -p $(BOOKDIR)/pretext/publication-rs-for-all.xml -x debug.rs.services.file /Users/bmiller/Runestone/RunestoneComponents/runestone/dist/webpack_static_imports.xml -d $(BOOKDIR)/pdf $(BOOKDIR)/pretext/thinkcspy.ptx
2534

26-
foo:
27-
python foo.py

README.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,27 @@ Getting Started
2323

2424
We have tried to make it as easy as possible for you to build and use this book.
2525

26-
1. You can see and read this book online at `interactivepython.org <http://interactivepython.org/runestone/static/thinkcspy/index.html>`_
26+
You can see and read this book online at `runestone.academy <http://runestone.academy/ns/books/published/thinkcspy/index.html?mode=browsing>`_
2727

28-
2. You can build it and host it yourself in just a few simple steps:
28+
.. important:: The restructuredText version of this book is deprecated!
29+
30+
Building with PreTeXt
31+
---------------------
32+
33+
1. Create a virtual environment
34+
2. pip install pretextbook
35+
3. To build run: pretext build --input pretext/thinkcspy.ptx --output output --format html --publication pretext/publication-rs-for-all.xml
36+
4. pretext view html
37+
38+
Note: The pretext sources are in the pretext folder, we will keep the _sources folder until we are 100% sure that the book has been converted correctly and as thoroughly as possible.
39+
40+
41+
Building with runestone
42+
-----------------------
43+
As mentioned above this method is deprecated, but will still work.
44+
Any updates to this book should be made in PreTeXt NOT RST.
45+
46+
You can build it and host it yourself in just a few simple steps:
2947

3048
1. ``pip install -r requirements.txt`` -- Should install everything you need
3149
2. ``runestone build`` -- will build the html and put it in ``./build/thinkcspy``

_sources/Functions/Functionscancallotherfunctions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ Here is the entire example with the necessary set up code.
138138
There are some points worth noting here:
139139

140140
* Functions can call other functions.
141-
* Rewriting `drawSquare` like this captures the relationship
141+
* Rewriting ``drawSquare`` like this captures the relationship
142142
that we've spotted.
143-
* A caller of this function might say `drawSquare(tess, 50)`. The parameters
143+
* A caller of this function might say ``drawSquare(tess, 50)``. The parameters
144144
of this function, ``tx`` and ``sz``, are assigned the values of the tess object, and
145145
the integer 50 respectively.
146146
* In the body of the function, ``tz`` and ``sz`` are just like any other variable.
147147
* When the call is made to ``drawRectangle``, the values in variables ``tx`` and ``sz``
148148
are fetched first, then the call happens. So as we enter the top of
149-
function `drawRectangle`, its variable ``t`` is assigned the tess object, and ``w`` and
149+
function ``drawRectangle``, its variable ``t`` is assigned the tess object, and ``w`` and
150150
``h`` in that function are both given the value 50.
151151

152152

_sources/PythonTurtle/OurFirstTurtleProgram.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ screen until we click on it.
262262
:practice: T
263263
:answer_a: <img src="../_static/test1Alt1.png" alt="right turn of 90 degrees before drawing, draw a line 150 pixels long, turn left 90, and draw a line 75 pixels long"/>
264264
:answer_b: <img src="../_static/test1Alt2.png" alt="left turn of 180 degrees before drawing, draw a line 150 pixels long, turn left 90, and draw a line 75 pixels long"/>
265-
:answer_c: <img src="../_static/test1Alt3.png" alt="left turn of 270 degrees before drawing, draw a line 150 pixels long, turn left 90, and draw a line 75 pixels long">/
265+
:answer_c: <img src="../_static/test1Alt3.png" alt="left turn of 270 degrees before drawing, draw a line 150 pixels long, turn left 90, and draw a line 75 pixels long"/>
266266
:answer_d: <img src="../_static/test1Alt4v2.png" alt="right turn of 270 degrees before drawing, draw a line 150 pixels long, turn right 90, and draw a line 75 pixels long"/>
267267
:answer_e: <img src="../_static/test1correct.png" alt="left turn of 90 degrees before drawing, draw a line 150 pixels long, turn left 90, and draw a line 75 pixels long"/>
268268
:correct: e

_sources/Strings/Exercises.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Exercises
1111
---------
1212

13-
#.
13+
1414

1515
.. tabbed:: q1
1616

@@ -47,7 +47,7 @@ Exercises
4747
:identifier: disqus_dc2457710a924d9283b12f42a31d2b27
4848

4949

50-
#.
50+
5151

5252
.. actex:: ex_8_2
5353

@@ -101,7 +101,7 @@ Exercises
101101

102102

103103

104-
#.
104+
105105

106106
.. tabbed:: q3
107107

@@ -176,14 +176,14 @@ Exercises
176176
:identifier: disqus_bf88b1c4616d43f289c798b56a43b01c
177177

178178

179-
#.
179+
180180

181181
.. actex:: ex_8_4
182182

183183
Print out a neatly formatted multiplication table, up to 12 x 12.
184184
~~~~
185185

186-
#.
186+
187187

188188
.. tabbed:: q5
189189

@@ -233,7 +233,7 @@ Exercises
233233
:identifier: disqus_bfd6f74a183c4682b29c72c4411200fb
234234

235235

236-
#.
236+
237237

238238
.. actex:: ex_8_5
239239
:practice: T
@@ -261,7 +261,7 @@ Exercises
261261

262262
myTests().main()
263263

264-
#.
264+
265265

266266
.. tabbed:: q7
267267

@@ -323,7 +323,7 @@ Exercises
323323
:identifier: disqus_70b7ac515456497c952a2de5caa27ab9
324324

325325

326-
#.
326+
327327

328328
.. actex:: ex_8_7
329329
:practice: T
@@ -353,7 +353,7 @@ Exercises
353353

354354

355355

356-
#.
356+
357357

358358
.. tabbed:: q9
359359

@@ -453,7 +453,7 @@ Exercises
453453
myTests().main()
454454

455455

456-
#.
456+
457457

458458
.. tabbed:: q11
459459

@@ -514,7 +514,7 @@ Exercises
514514
:identifier: disqus_2f2772134b604a6498748138542d312d
515515

516516

517-
#.
517+
518518

519519
.. actex:: ex_8_11
520520
:practice: T
@@ -544,7 +544,7 @@ Exercises
544544
myTests().main()
545545

546546

547-
#.
547+
548548

549549
.. tabbed:: q13
550550

@@ -629,7 +629,7 @@ Exercises
629629
:identifier: disqus_ab823200fac64461a9e88f53b75f5795
630630

631631

632-
#.
632+
633633
.. actex:: ex_8_13
634634
:nocodelens:
635635

@@ -640,7 +640,7 @@ Exercises
640640
Y -> -FX-Y
641641
~~~~
642642

643-
#.
643+
644644

645645
.. tabbed:: q15
646646

@@ -722,7 +722,7 @@ Exercises
722722
:identifier: disqus_9b2dfba083a64d5c894f873af2e93a1b
723723

724724

725-
#.
725+
726726
.. actex:: ex_8_15
727727
:nocodelens:
728728

@@ -733,7 +733,7 @@ Exercises
733733
Y -> -FX+YFYF++YF+FX--FX-Y
734734
~~~~
735735

736-
#.
736+
737737

738738
.. tabbed:: q17
739739

@@ -821,7 +821,7 @@ Exercises
821821
:identifier: disqus_912a5f19d3964dc2af7a067dcd832c7e
822822

823823

824-
#.
824+
825825
.. actex:: ex_8_17
826826

827827
Write a function that implements a substitution cipher. In a substitution
@@ -832,7 +832,7 @@ Exercises
832832
return a string that is the encrypted version of the message.
833833
~~~~
834834

835-
#.
835+
836836

837837
.. tabbed:: q19
838838

@@ -888,7 +888,7 @@ Exercises
888888
:identifier: disqus_d7d1ca00bfff4e7bacf886386fb3302e
889889

890890

891-
#.
891+
892892

893893
.. actex:: ex_8_19
894894
:practice: T
@@ -918,7 +918,7 @@ Exercises
918918
myTests().main()
919919

920920

921-
#.
921+
922922

923923
.. tabbed:: q21
924924

@@ -970,7 +970,7 @@ Exercises
970970
:identifier: disqus_49e1151bb7864a3287a6b6ae1c84db16
971971

972972

973-
#.
973+
974974

975975
.. actex:: ex_8_22
976976
:timelimit: 60

_sources/UnitTesting/Exercises.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
Exercises
1010
---------
1111

12-
#.
13-
1412
.. tabbed:: tab_ut_reverse
1513

1614
.. tab:: Question
@@ -90,7 +88,6 @@ Exercises
9088
assert reverse('b') == 'b'
9189
assert reverse('') == ''
9290

93-
#.
9491

9592
.. tabbed:: tab_ut_testable
9693

_sources/UnitTesting/WritingUnitTests.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -175,30 +175,30 @@ to pass even if you rework the function implementation.
175175
assert grade(85) == 'B'
176176
assert grade(69) == 'F'
177177

178-
.. reveal:: ac_grade_unittest_aux_reveal
179-
:instructoronly:
180-
181-
.. actex:: ac_grade_unittest_aux
182-
183-
testA = False
184-
testB = False
185-
testF = False
186-
illegal = False
187-
188-
def grade(score):
189-
global illegal, testA, testB, testF
190-
191-
if score > 100 or score < 0:
192-
illegal = True
193-
return ''
194-
elif score >= 90:
195-
testA = True
196-
return 'A'
197-
elif score >= 80:
198-
testB = True
199-
return 'B'
200-
else:
201-
testF = True
202-
return 'F'
178+
.. .. reveal:: ac_grade_unittest_aux_reveal
179+
.. :instructoronly:
180+
181+
.. .. actex:: ac_grade_unittest_aux
182+
183+
.. testA = False
184+
.. testB = False
185+
.. testF = False
186+
.. illegal = False
187+
188+
.. def grade(score):
189+
.. global illegal, testA, testB, testF
190+
191+
.. if score > 100 or score < 0:
192+
.. illegal = True
193+
.. return ''
194+
.. elif score >= 90:
195+
.. testA = True
196+
.. return 'A'
197+
.. elif score >= 80:
198+
.. testB = True
199+
.. return 'B'
200+
.. else:
201+
.. testF = True
202+
.. return 'F'
203203
204204

0 commit comments

Comments
 (0)