Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in-image book reader #222

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e571a68
add first version of BookExtract
LinqLover Nov 21, 2023
fa6d126
book-extract: fix baseline for sb-tree-sitter
LinqLover Nov 21, 2023
964aab8
update todos for extract-book
LinqLover Nov 21, 2023
bf876b3
extract-book: make texts and images aware of UI theme and scale facto…
LinqLover Nov 21, 2023
1516397
document storing and reading of books
LinqLover Nov 21, 2023
974043c
allow updates via metacello
LinqLover Nov 21, 2023
955817f
fix text selection for squeak60
LinqLover Nov 21, 2023
eeb02e1
fix extension method prefix
LinqLover Nov 21, 2023
0d72c8b
fix inline clickable images
LinqLover Nov 21, 2023
6aa4d21
handle math mode
LinqLover Nov 21, 2023
e1842b6
book: add compatibility patches for squeak60
LinqLover Nov 21, 2023
d1547e3
fix use of compatibility methods
LinqLover Nov 21, 2023
38c9024
fix handling of \SQUEAKVERSION and \SqVersionSwitch
LinqLover Nov 25, 2023
0784c92
improve parsing of math
LinqLover Nov 25, 2023
6ff0427
fix linebreaks after \\
LinqLover Nov 25, 2023
d2b7fc7
parse \~ correctly
LinqLover Nov 25, 2023
eae9b2e
add pdf urls
LinqLover Nov 25, 2023
6de5db4
update extractor example with squeakVersion and pdfUrl
LinqLover Nov 25, 2023
b1c98ee
update and extend SBEHelp prosa
LinqLover Nov 25, 2023
c3ddb21
ci: upload generated figures as artifact
LinqLover Nov 25, 2023
efce7ed
fix ci slip
LinqLover Nov 25, 2023
f543db6
update serialization
LinqLover Nov 25, 2023
a424ed7
handle further character commands
LinqLover Nov 26, 2023
eec5d41
ignore bibliography
LinqLover Nov 26, 2023
24e92d4
extract-book: add index (DOM, links, (de)serialization)
LinqLover Nov 26, 2023
67731ff
book node: cache anchorLabels
LinqLover Nov 26, 2023
3b5a440
fix handling of pendingLabels for formatted texts
LinqLover Nov 26, 2023
72a0c92
refactor: move label opening from book node to label link
LinqLover Nov 26, 2023
51ce8c4
update preface and mention index
LinqLover Nov 26, 2023
61df36d
check book for invalid links
LinqLover Nov 26, 2023
d763eb4
docs
LinqLover Nov 26, 2023
44bd868
avoid duplicate #withBlanksTrimmed
LinqLover Nov 26, 2023
c26e3ab
Merge branch 'master' into extract-book
LinqLover Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update and extend SBEHelp prosa
LinqLover committed Nov 25, 2023
commit b1c98ee55c635a95dbc769e5e6a4afd5c3f8d319
Original file line number Diff line number Diff line change
@@ -12,10 +12,10 @@ Squeak by Example is a book, intended for both students and developers, that wil

About this version of the book

Squeak by Example is a classical book intended for PDF/print format in the first place. Nevertheless, we made some efforts to make it available right in Squeak. For this, we wrote our own LaTeX parser that uses Sandblocks'' Tree-sitter integration and a LaTeX grammar for tree-sitter to convert over 10,000 SLOC of text into Squeak objects (don''t try this at home!!). You can read the result in this help structure or search it using the search bar at the top. Note that this parser is meant to be an approximation only and we didn''t get every space right to save our own sanity. Nevertheless, if you''ve got any questions or feedback, we''re there at our GitHub repo: https://github.com/hpi-swa-lab/SqueakByExample-english
Squeak by Example is a traditional book intended for PDF/print format in the first place. Nevertheless, we made some efforts to make it available right in Squeak. For this, we wrote our own LaTeX parser that uses Sandblocks'' Tree-sitter integration and a LaTeX grammar for tree-sitter to convert over 10,000 SLOC of text into Squeak objects (don''t try this at home!!). You can read the result in this help structure or search it using the search bar at the top. Note that our parser is meant to be an approximation only and we didn''t get every space right to save our own sanity. However, if you''ve got any questions or feedback, we''re there at our GitHub repo: https://github.com/hpi-swa-lab/SqueakByExample-english

Enjoy and carpe Squeak!!!
]style[(17 2 17 365 30 53 3 1 5 151 11 1 11 1 11 7 13 399 56 23)b,,Rhttps://github.com/hpi-swa-lab/SqueakByExample-english;,,b,,Rhttps://github.com/hpi-swa-lab/SqueakByExample-english/releases;,,Rhttps://www.lulu.com/shop/patrick-rein-and-christoph-thiede/squeak-by-example-60/paperback/product-8vr2j2.html;,,Rhttps://github.com/hpi-swa/sandblocks;,,Rhttps://tree-sitter.github.io/tree-sitter/;,,Rhttps://github.com/hpi-swa-lab/sb-tree-sitter;,,Rhttps://github.com/latex-lsp/tree-sitter-latex;,,Rhttps://github.com/hpi-swa-lab/SqueakByExample-english;,!' readStream nextChunkText)
]style[(17 2 17 365 30 55 3 1 5 151 11 1 11 1 11 7 13 393 56 23)b,,Rhttps://github.com/hpi-swa-lab/SqueakByExample-english;,,b,,Rhttps://github.com/hpi-swa-lab/SqueakByExample-english/releases;,,Rhttps://www.lulu.com/shop/patrick-rein-and-christoph-thiede/squeak-by-example-60/paperback/product-8vr2j2.html;,,Rhttps://github.com/hpi-swa/sandblocks;,,Rhttps://tree-sitter.github.io/tree-sitter/;,,Rhttps://github.com/hpi-swa-lab/sb-tree-sitter;,,Rhttps://github.com/latex-lsp/tree-sitter-latex;,,Rhttps://github.com/hpi-swa-lab/SqueakByExample-english;,!' readStream nextChunkText)
key: #introduction;
shouldStyle: false;
yourself
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
pages

^ #("introduction" "<- enable for edits" theBook)
^ #("introduction" "<- enable for edits" preface theBook)
21 changes: 21 additions & 0 deletions SmalltalkSources/SBE-Book.package/SBEHelp.class/class/preface.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pages
preface
"This method was automatically generated. Edit it using:"
"SBEHelp edit: #preface"
<generated>
^(HelpTopic
title: 'How to use this book'
contents:
'How to use this book

You can read this book from beginning to end, from end to beginning, or browse through random sections as your interests take you. Either way, here are some tips on how to get the most out of reading this book right in Squeak:

Interactive contents. Since Squeak is a super-duper-interactive system, you can also interact directly with the contents of this book. For example, you can select any mentioned message and press Cmd+m to browse its implementors, just like anywhere else in the image. Analogously, Cmd+b is available to browse a class definition, Cmd+p to print an expression, Cmd+D to debug it, and all your other favorite shortcuts.

Smart search. Did you notice the search bar at the top of this window? You can search the entire book with it!!!!1 More importantly, if you also have installed the SemanticText package, this will even perform a smart search powered by OpenAI. So, instead of "exception handling", you could just search for "catch errors". Note that this is an experimental feature and watch out for artificial stupidity and hallucinations.

Fallback to PDF. While we managed to parse most of the book in a satisfactory quality, we just could not get some things right (yet). (Imagine parsing a context-sensitive language with a context-free grammar?) So, if you encounter an unreadable artifact, send your thanks to Donald Knuth and yellow-click on the relevant section in the tree to open it in a PDF in the great darkness outside of Squeak.!
]style[(21 229 22 173 5 15 12 53 5 44 5 4 5 16 5 4 8 42 13 409 16 385)b,,b,,i,,i,,i,,i,,i,,i,,i,,b,,b,!' readStream nextChunkText)
key: #preface;
shouldStyle: false;
yourself
Original file line number Diff line number Diff line change
@@ -5,8 +5,9 @@
"bookBlurb" : "ct 11/15/2023 17:39",
"bookName" : "ct 11/15/2023 17:30",
"icon" : "ct 11/15/2023 21:37",
"introduction" : "ct 11/15/2023 18:03",
"pages" : "ct 11/21/2023 13:58",
"introduction" : "ct 11/25/2023 21:11",
"pages" : "ct 11/25/2023 21:11",
"preface" : "ct 11/25/2023 21:28",
"squeakBalloonIcon" : "ct 11/15/2023 17:33",
"theBook" : "ct 11/15/2023 17:37" },
"instance" : {