Note taking with Asciidoctor

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Note taking with Asciidoctor

getreu
This post was updated on .
Markup languages like Asciidoc are perfectly suited for quick note taking. Type your notes with your favourite editor, view and browse them with Chromium, Chrome or Firefox.

All you need is the adoc-note script and Chromium, Chrome or Firefox with the Chrome Asciidoctor.js Live Preview extension or the Firefox Asciidoctor.js Live Preview extension.


The project is hosted on Github: https://github.com/getreu/asciidoctor-notetaking

Documentation (html)
Documentation (pdf)

The program runs under Linux and Windows.
suy
Reply | Threaded
Open this post in threaded view
|

Re: Note taking with Asciidoctor

suy
El Sunday 29 November 2015, escribió:

> Markup languages like `Asciidoc` are perfectly suited for quick note
> taking. Type your notes with your favourite editor, view and browse them
> with `Firefox` or `Chrome`.
>
> All you need is the following 4 scripts and Firefox or Chrome with the
> Firefox Asciidoctor.js Live Preview
> <https://addons.mozilla.org/en-US/firefox/addon/asciidoctorjs-live-preview/
> > extension or the  Chrome Asciidoctor.js Live Preview
> <https://chrome.google.com/webstore/detail/asciidoctorjs-live-previe/iaalpf
> gpbocpdfblpnhhgllgbdbchmia> extension.

Thank you for the sharing your concept and experience. There are a bunch of
things that are a no-go for me, though. First, note that it wasn't clear to me
what kind of scripts you were talking about in the beginning of the document.
Since you were talking about the browser, I understood those were scripts in
the browser that let you type "adoc-view" in the location box or something.

Second, the scripts have some important flaws to be widely usable. I'll start
with the last one, since is the easier:

#!/bin/dash
(...)

This will not run at all unless you have the dash shell, which I think now is
the preferred in Debian, but it will not work in many many other systems (it
would not work even on Debian systems where it wasn't an essential package).

(...)
# Open Chromium and Geany
# Install asciidoctor plugin in chromium. Click right and "reload"
#chromium "$FilePathName" &

iceweasel "$FilePathName" &

Again, this hardcodes an application name that might only available to those
who have it installed. Other distributions just don't have it. And not all
Debian systems have it. You should use something like x-www-browser instead.
And even more importantly: you should use the full path or you just have a big
security hole.


--
Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
http://barnacity.net/ | http://disperso.net
Reply | Threaded
Open this post in threaded view
|

Re: Note taking with Asciidoctor

mojavelinux
Administrator
In reply to this post by getreu
Thanks for sharing, Jens!

If you haven't alreay, perhaps you would consider making a repository on GitHub so that others can help build on this concept.

Cheers,

-Dan

On Sun, Nov 29, 2015 at 2:07 PM, getreu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Markup languages like `Asciidoc` are perfectly suited for quick note taking.
Type your notes with your favourite editor, view and browse them with
`Firefox` or `Chrome`.

All you need is the following 4 scripts and Firefox or Chrome with the  Firefox Asciidoctor.js Live Preview extension or the Chrome Asciidoctor.js Live Preview extension.

`adoc-new-note`:: Creates new context depending asciidoc note files.

`adoc-edit`:: Launches an editor and live-previewer.

`adoc-view`:: Launches firefox to render and browse notes with links.

`adocTitleFilenameSync`:: Keeps the asciidoc titles and filenames in sync.

Scripts and manual:
Note taking with Asciidoctor
(pdf)



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Note-taking-with-Asciidoctor-tp3991.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Note taking with Asciidoctor

getreu
In reply to this post by suy
Thank you for your feedback!

== @suy:

* dash

You are right. Any ash shell should do. Under Debian/Ubuntu #/bin/sh points to dash.
I will replace it.

* make editor and browser calls more generic:

Yes definately. If you have ideas how this could be done in a way that it works with all distributions please tell.

/etc/alternatives comes into my mind. And still, different programs require different parameters

For the moment I am interested in running the scripts under Windows. I made some tests they run in a Linux busybox. Windows busybox tests are still outstanding.

== @mojavelinux

Done:

https://github.com/getreu/asciidoctor-notetaking

Kindly Jens
suy
Reply | Threaded
Open this post in threaded view
|

Re: Note taking with Asciidoctor

suy
El Thursday 03 December 2015, getreu [via Asciidoctor :: Discussion] escribió:
> Yes definately. If you have ideas how this could be done that it works with
> all distributions please tell.
>
> /etc/alternatives comes into my mind. And still different programs require
> different options...

I am not sure that the alternatives system works in other non-Debian
distributions. $EDITOR is normally a "standard" variable. I think it should
open at least one enabled editor. There are also xdg-open and others. Just
remember to use full paths to prevent possible security problems.

--
Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
http://barnacity.net/ | http://disperso.net
Reply | Threaded
Open this post in threaded view
|

Re: Note taking with Asciidoctor

getreu
I rewrote the asciidoctor-notetaking script from scratch.

* only one script for "new-note", "edit" and "view",
* runs under Linux and Windows!
* configurable

Download:
https://github.com/getreu/asciidoctor-notetaking

Testing and feedback is welcome!
Reply | Threaded
Open this post in threaded view
|

Re: Note taking with Asciidoctor

mojavelinux
Administrator
Nice work!

-Dan

On Sat, Dec 5, 2015 at 1:53 AM, getreu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I rewrote the asciidoctor-notetaking script from scratch.

* only one script for "new-note", "edit" and "view",
* runs under Linux and Windows!
* configurable

Download:
https://github.com/getreu/asciidoctor-notetaking

Testing and feedback is welcome!


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Note-taking-with-Asciidoctor-tp3991p4022.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Note taking with Asciidoctor

getreu
Thank you!  :)

The sync(title:subtitle) -> filename part was quite tricky. Windows filesystems especially fat32 are very restrictive!
I am curious how well windows-busybox and windows filesystems support unicode. Let's see next week.

I managed to retain a title-subtitle marker "--" in the generated filename. Looks quite good in file listings.




Jens
Reply | Threaded
Open this post in threaded view
|

Re: Note taking with Asciidoctor

getreu
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Convert Asciidoc titles into filenames

getreu
This post was updated on .
Here the code that translates Asciidoc Title into Filenames:

	SanitizeFilename="$(echo "$1"| \
		tr -s '[:blank:]'   ' '| \
		tr -d '[:cntrl:]' | \
		sed -e  's/:[[:blank:]]*$//g; s/\(.*\):\(.*\)/\1--\2/g'| \
		tr -s ':\\/|?~,;='   '_'| \
		tr -s '<>:"\\/|?*<>#%{}|\^~[]+,;=[]`[:blank:]'    ' '| \
		sed -e 's/[[:blank:]_]*\(.*\)/\1/g; s/[[:blank:]_]*$//g' \
			-e 's/[[:blank:]_]*--[[:blank:]_]*/--/g'
 		)"

It usually results in well readable filenames even with titles containing many special characters.

Asciidoc title - filename sync is documented here.

You can test the code with this adoc-note script.

Mirroring Asciidoc titles and filenames could be useful for similar projects as well. A common policy on a converting algorithm would allow to exchange notes within different tools.  Feedback is welcome.