Comments (24)
I've implemented the extension in experimental
folder package.
We should look at how to rearrange code, etc
from erudite.
That's why I need to do proper work on these method wrapping libraries. Not tests atm :)
from erudite.
I was thinking perhaps not in a different package, do it in the same package. When I say optional, I mean conditional in the code, like extensions work without darkmode stuff. But you are already using it for formulas, so then no problem. But if it can be optional, like say, for uml, let uml work without imagemagik, unless it is enabled. Not make it hard requirement, unless necessary.
from erudite.
So part of dark-mode logic is detecting if the user is running a dark theme. If the user is running a light theme, the logic will not attempt to generate or set the dark-mode image.
from erudite.
Maybe .. but .. how would you render a table with current Cuis text rendering capabilities?
Perhaps embedding some kind of TableMorph, I'm not sure..
About the syntax, I have not thought about it. Perhaps a way forward would be to start seriously considering the possibility of having multiple syntax extensions at once, with the MethodAdvisers approach (it doesn't occur to me an alternative method). Then you are free to implement your own Table extension parser as you please.
These are only my thoughts off the top my head.
from erudite.
One way, perhaps not the cleanest or most efficient, but similar to what we've doing with the other extensions, would be to integrate https://wkhtmltopdf.org.
I've tried wkhtmltoimage table.html table.png
with:
<style>
table, th, tr, td {
border:1px solid
}
</style>
<table>
<tr><td>Hello</td><td>World</td>
</table>
So, one idea could be to implement an HTML extension instead of table extension. This would not support Erudite syntax inside the tables, though.
from erudite.
Yes, that might be the easiest thing to implement for now.
When I can find the time, I'll see if I can make an extension based on MethodAdvisers and see if I can convert/combine the other extensions to/with it as well.
from erudite.
By the way, I noticed the following behavior in around:do:
:
MethodAdviserTestSubject around: #test1 do: [:receiver :nextMethod |
Transcript show: 'Start around'.
nextMethod value.
Transcript show: 'End around'.
'wrapped test1'].
MethodAdviserTestSubject around: #test1 do: [:receiver :nextMethod |
Transcript show: 'Start around around'.
nextMethod value.
Transcript show: 'End around around'.
'wrapped test1'].
MethodAdviserTestSubject new test1
Results in the following transcript output
Start around
Start around around
test1
End around around
End around
wrapped test1
Maybe my intuition for this is off, but I would have expected
Start around around
Start around
test1
End around
End around around
wrapped test1
from erudite.
Why do you have that intuition? That's how other method adviser libraries work?
What the around method is doing is installing a wrapping method, on top of the existing method. And so, the last method you add is the first to execute; the last you add becomes the top-level wrapping method.
from erudite.
Sorry, you are right, the second output should be the correct. I'll have a look. That's strange ..
from erudite.
Added some tests.
from erudite.
I've implemented the extension in
experimental
folder package.We should look at how to rearrange code, etc
I'm working on porting formulas and plots over to EruditeExtensions. I think I'll just organize the code to match that of the HTML and UML extensions. Let me know if you prefer otherwise.
from erudite.
That's good. Go ahead, please.
from erudite.
While I'm at it, I could also enable the dark-mode functionality for HTML and UML. Should I do that? It would make the extensions more uniform, but it would also add ImageMagick as a dependency to those extensions. Also, I understand if that is considered feature creep maybe. I can also remove it entirely if you prefer... It's just nice to have if you're using a dark theme. Especially for formulas.
from erudite.
Is there a way of shipping that separately somehow?
from erudite.
Ok. Do it. We are already using lots of external applications already. But, it would be nice if you can factor it so that the behaviour is optional, all extensions work without ImageMagick installed, and if possible, do it in a separate method, like let's say #enableDarkMode
, and you do dark mode stuff there. Is it possible to do it like that?
from erudite.
I think it should be possible to make dark mode optional.
ImageMagick is unfortunately already needed by the Formulas extension. That's because mimeTex can only generate GIF and Cuis can only read PNG, so there is call to ImageMagick to convert the GIF to PNG already when generating the formula image.
To make dark mode optional, I think it can be its own package, say EruditeExtensionsDarkMode(?) that depends on EruditeExtensions. I expect it should be possible to use MethodAdvisers also to implement this.
from erudite.
Alright, understood. I'll give it a shot.
from erudite.
So I think I'm almost there with a solution. One question about what you would prefer. I'm not sure which route to take:
- Turn dark-mode logic off by default. When the user turns it on, then dark-mode logic will run for DocNodes that support it (ATM: UML, HTML, Formulas, Plots) and failing to generate a dark-mode image will result in an error.
- Turn dark-mode logic on by default, and if the logic fails to generate a dark-mode image for whatever reason then fail silently and fallback to the original image.
These are just the ones that I could think of that make sense to me. Let me know if you have a different preference.
Note, currently it's a 'reader-side' logic. So this logic runs when the document is rendered. I felt this is more in line with i.e. dark reader extensions in the browser. But mainly it's simpler to implement as the book does not need to carry dark-mode images in the document data.
from erudite.
I think I would go for 2), but not turning dark-mode on by default, but detect if user is using darkmode. Possible?
from erudite.
Tested on Windows and Linux, please have a look
from erudite.
Feel free to close this issue.
from erudite.
Final remark: at this point you can remove EruditeMath.pck.st if you want since EruditeExtensions replaces it. Even though EruditeMath works better with the latex renderer, to be honest that part is not very interesting for me. So feel free to remove EruditeMath.
from erudite.
Ok. I'm not sure what to do with old vs new extensions yet ...
from erudite.
Related Issues (10)
- Unable to open an Erudite book after installing EruditeExtensions HOT 9
- PetitParserTutorial doesn't load HOT 1
- Remove gnuplot support from EruditeExtensions / EruditeMath HOT 2
- Installing [Erudite] requires base system updates to #6247 but this system is updated to #6161. HOT 7
- Petit Parser - wrong version HOT 5
- Typo in MorphicBook.pck.st
- Petit Parser tutorial error HOT 3
- UML not parsed in nested book sections HOT 5
- "save as" in editor does not preserve language extension HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erudite.