The main issue is that -ideally- we would like the e-book to be as
self-contained as possible
Ah. That point about self-containment hadn't occurred to me for some
reason, but that makes a lot of sense.
1. Regarding the colouring of code: The javascript library, or to have
a method that, in the end, produces "a string of raw HTML"
(potentially with a CSS, if that is easier for you), so the colouring
of code does not depend on external websites.
Okay, I've now made such a thing. You can download it here
<https://github.com/NetLogo/highlight-nl/releases/download/v0.1.0/highlight-nl.zip>,
and you can find its nature and usage explained here
<https://github.com/NetLogo/highlight-nl#highlight-nl>. Essentially,
include the CSS file and the JS file on your page, and then, from
JavaScript, just call the function returned by `require('highlight-nl')`
to convert your string of NetLogo code into a string of
syntax-highlighted HTML.
That said, I just made this thing and haven't given it a huge amount of
love yet. It did fine with a basic test, but you'll be the first (and
maybe only) person using it, so it's possible that there might be bugs
with it. If you run into any problems with it, feel free to let me know
here or on the issue tracker attached to the GitHub repository linked above.
2. Regarding running NetLogo models: To have a NetLogo engine inside
the book, so everything works even if NetLogo changes too much for our
code. (And potentially be able to change the css of NetLogoWeb
slightly, to make running models fit better with the rest of the
e-book, e.g. fig.1 at
http://ccl.northwestern.edu/2016/WeintropEtAlConstructionism2016-1.pdf)
Okay, got it. Do you already know all of the models you want to use? I
primarily ask because I want to know if NetLogo Web can already do
everything you want to be able to do in your book, or if it makes sense
to hold off on this plugin until some feature or another is implemented.
On 09/01/2016 12:13 PM, Luis R. Izquierdo wrote:
Dear Jason,
Thank you so much for your extremely helpful reply. The main issue is
that -ideally- we would like the e-book to be as self-contained as
possible, i.e. we would like the models in the book (and the colouring
of the code) to work even if future versions of Netlogo make changes
that imply the old code would not work (e.g. the use of + to
concatenate strings before NetLogo 4.0).
Because of that, our preference would be:
1. Regarding the colouring of code: The javascript library, or to have
a method that, in the end, produces "a string of raw HTML"
(potentially with a CSS, if that is easier for you), so the colouring
of code does not depend on external websites.
2. Regarding running NetLogo models: To have a NetLogo engine inside
the book, so everything works even if NetLogo changes too much for our
code. (And potentially be able to change the css of NetLogoWeb
slightly, to make running models fit better with the rest of the
e-book, e.g. fig.1 at
http://ccl.northwestern.edu/2016/WeintropEtAlConstructionism2016-1.pdf)
Another option would be to have iframes for everything, making sure
that the links work as expected. This approach is great for webpages,
but maybe not so great for an ebook, which at the end of the day is a
book, and should have a stable, permanent edition at some point.
To be honest, we can see pros and cons in both approaches (especially
regarding running models), so we would love to hear your comments (and
most likely to adopt your advice).
Thank you so much for your help,
Luis
On Thursday, 1 September 2016 11:25:27 UTC-5, Jason Bertsche wrote:
Hello,
Thanks for your interest in a NetLogo Web-powered e-book. I think
that sounds awesome!
(Also, sorry for my delay in responding.)
Is writing two wordpress plugins the best approach to achieve
what we need?, or can you think of a better way of doing these
two tasks?
Well, the syntax highlighter is something that I'm not sure could
even reasonably be done without us supplying that for you.
However, I'm supportive of seeing these things implemented, so I'm
fine with helping out with that.
1. One that would take NetLogo code as text and would format it
exactly as it looks in NetLogo, including colours (like in the
"NetLogo Code" tab of NetLogoWeb)
How do you want this to work, though? Do you want to hit a URL on
our site in order to make the highlighting happen, or do you want
a JavaScript library that you can drop into your page? Do you
want a string of raw HTML back that you drop into your page? Do
you just want to query our server for a syntax-highlighted page
that you embed through an `iframe`? Something else?
Honestly, the `iframe` option is what is seeming the most feasible
to me at the moment. I feel like I could put that together pretty
quickly, but let me know if that doesn't meet your needs.
2. Another one that allows running NetLogo models within
Wordpress. (Presumably this could be done with an iframe, but
we're looking for something more efficient and better integrated
within wordpress).
I can look into this option with you all, but I'm not sure what
you mean by more "efficient" here, or in what way it needs to be
better integrated into Wordpress. It would help me to know what
problems you're trying to solve by favoring Wordpress integration
over embedding the NLW page through an `iframe`.
On 08/25/2016 08:29 AM, Luis R. Izquierdo wrote:
Dear netlogo-devel Community,
We are 3 researchers who are thinking of writing an open e-book
using the wordpress-based platform Pressbooks
(https://wordpress.org/plugins/pressbooks/
<https://urldefense.proofpoint.com/v2/url?u=https-3A__wordpress.org_plugins_pressbooks_&d=CwMFaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI&m=BW-z1Y3oXJXapQBy4sZ5q4Lsban13XLil83WEDbkONM&s=yLAiTLmERVLykTg7Kh16Vrft4AIvmIJO0kuxRWwAoss&e=>).
We would like to include NetLogo code and actual NetLogo running
models within the e-book. For that, ideally we would want two
pieces of software:
1. One that would take NetLogo code as text and would format it
exactly as it looks in NetLogo, including colours (like in the
"NetLogo Code" tab of NetLogoWeb)
2. Another one that allows running NetLogo models within
Wordpress. (Presumably this could be done with an iframe, but
we're looking for something more efficient and better integrated
within wordpress).
We have only basic knowledge of HTML, CSS and Javascript, so at
this stage our main question is:
Is writing two wordpress plugins the best approach to achieve
what we need?, or can you think of a better way of doing these
two tasks?
There may be quick and dirty ways of achieving our goals for the
book (_and we would love to hear about them!_) but, looking
ahead, we are also interested in knowing the proper way of doing
this NetLogo-Wordpress integration (especially because we may be
able to engage some of our students to write this type of
software, which we believe could benefit other people too).
Any thoughts would be most appreciated,
Thanks a lot,
Luis, Segis and Bill
--
You received this message because you are subscribed to the
Google Groups "netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected] <javascript:>.
For more options, visit https://groups.google.com/d/optout
<https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=CwMFaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI&m=AYYVbN5AHdKZj1sKHK-HWqnDy2dxK0QB0fqMMZvr7zg&s=FdCx4RYnvR_cFBgFw4HfrIHh2LfbXNj3ORZ0fL-K8uA&e=>.
--
You received this message because you are subscribed to the Google
Groups "netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout
<https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=CwMFaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI&m=BW-z1Y3oXJXapQBy4sZ5q4Lsban13XLil83WEDbkONM&s=OTaGHrhvhkc-jTmVk1odful_h8irSEb2FXObf0ghXg8&e=>.
--
You received this message because you are subscribed to the Google Groups
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.