Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-30 Thread Eric Schulte
Nitin Agarwal  writes:

> The edit button appears only for the content of the subheadings or
> headings of the document.

Look at the call to `org-export-define-derived-backend' in line 107 of
org-ehtml-client [1].  Notice that it defines editable versions of the
existing html export functions for each of the types listed (paragraph,
plain-list, etc...).  These types correspond to org-mode elements as
defined by org-elements.el.

To make the content of headlines editable, you should define a new
export function for headlines either using the `def-ehtml-wrap' function
or possibly using a new export function.

If you do share new code please do so either as diffs against existing
code, or as pull requests on github.  It is too difficult to find the
relevant changes in source code pasted directly into email messages.

Cheers,

Footnotes: 
[1]  
https://github.com/eschulte/org-ehtml/blob/master/src/org-ehtml-client.el#L107

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-30 Thread Nitin Agarwal
Hi,
Somehow we have to edit the org-ehtml-server.el and the org-ehtml-client.el
file in order to the edit the orgmode file as editable web page where we
can edit the headings
or subheadings.

functions defined in the org-ehtml-server.el file

(defun org-ehtml-handler (httpcon)
  (elnode-log-access "org-ehtml" httpcon)
  (elnode-method httpcon
(GET  (org-ehtml-file-handler httpcon))
(POST (org-ehtml-edit-handler httpcon

(defun org-ehtml-file-handler (httpcon)
  (let ((elnode-docroot-for-no-404 t) (elnode-docroot-for-no-cache t))
(elnode-docroot-for org-ehtml-docroot :with file :on httpcon :do
  (org-ehtml-serve-file file httpcon

(defun org-ehtml-serve-file (file httpcon)
  (cond
   ;; normal files (including index.org or index.html if they exist)
   ((or (not (file-directory-p file))
(let ((i-org  (expand-file-name "index.org" file))
  (i-html (expand-file-name "index.html" file)))
  (or (and (file-exists-p i-org)  (setq file i-org))
  (and (file-exists-p i-html) (setq file i-html)
(elnode-send-file httpcon
  (if (member (file-name-extension file) '("org" "html"))
  (org-ehtml-client-cached file) file)))
   ;; directory listing
   ((file-directory-p file)
(let ((pt (elnode-http-pathinfo httpcon)))
  (elnode-http-start httpcon 200 '("Content-type" . "text/html"))
  (elnode-http-return httpcon
(elnode--webserver-index
 org-ehtml-docroot file pt org-ehtml-dir-match
   ;; none of the above -> missing file
   (t (elnode-send-404 httpcon

(defun org-ehtml-edit-handler (httpcon)
  (let* ((params (elnode-http-params httpcon))
 (path   (substring (cdr (assoc "path" params)) 1))
 (beg (string-to-number (cdr (assoc "beg"  params
 (end (string-to-number (cdr (assoc "end"  params
 (org   (cdr (assoc "org"  params
(when (string= (file-name-nondirectory path) "")
  (setq path (concat path "index.org")))
(when (string= (file-name-extension path) "html")
  (setq path (concat (file-name-sans-extension path) ".org")))
(org-babel-with-temp-filebuffer (expand-file-name path
org-ehtml-docroot)
  (let ((orig (buffer-string)))
(replace-region beg end org)
(if (run-hook-with-args-until-failure 'org-ehtml-before-save-hook)
(save-buffer)
  (replace-region (point-min) (point-max) orig)
  (elnode-send-500 httpcon "edit failed
`org-ehtml-before-save-hook'")))
  (run-hooks 'org-ehtml-after-save-hook))
(elnode-http-start httpcon "200" '("Content-type" . "text/html"))
(elnode-http-return httpcon
  (org-export-string org 'html org-ehtml-docroot

(provide 'org-ehtml-server)
This provides the org-ehtml-server function on the backend side to export
the org-ehtml file as editable web page and make the changes to the
org-file on the server side to the org file.

functions identified in the org-ehtml-client.el file

(defvar org-ehtml-everything-editable nil
  "Set to a true value to everything exported by org-ehtml editable.")

(defvar org-ehtml-editable-types
  '(paragraph plain-list table verbatim quote-block verse-block)
  "Types of elements whose children should not be editable.")

(defun org-ehtml-client-editable-p (element info)
  (let ((parent (org-export-get-parent element)))
(cond ((eq (car parent) 'headline)
   (or org-ehtml-everything-editable
   (member "EDITABLE" (org-export-get-tags parent info
  ((eq (car parent) 'org-data)
   (or org-ehtml-everything-editable
   (some
(lambda (keyword)
  (let ((key (plist-get (cadr keyword) :key))
(val (plist-get (cadr keyword) :value)))
(and (string= "PROPERTY" key)
 (string-match "editable \\(.+\\)" val)
 (car (read-from-string (match-string 1 val))
(cddr (caddr parent)
  ((member (car parent) org-ehtml-editable-types) nil)
  (t (org-ehtml-client-editable-p parent info)

(defmacro def-ehtml-wrap (e-html-function)
  "Defines and returns an ehtml-wrapped version of E-HTML-FUNCTION."
  (let ((fname (intern (concat "org-ehtml-client"
   (substring (symbol-name e-html-function)
10)
`(defun ,fname (element contents info)
   ,(format "ehtml wrapper around `%s'." e-html-function)
   (let* ((original-contents (copy-seq contents))
  (original-info (copy-seq info))
  (html-text (,e-html-function element contents info))
  (org-text  (or (org-element-interpret-data element)
 original-contents
 (error "no org-text found for %s" (car
element)
 (if (org-ehtml-client-editable-p element info)
 (org-fill-template org-ehtml-client-wrap-template
  `(("htm

Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-29 Thread Nitin Agarwal
The edit option comes only for the content of the headings. We can't edit
the headings and the subheadings of the headings.
So the source code has to be modified to make the org-mode document
editable as HTML where we can edit the Headings and subheadings.
The edit button appears only for the content of the subheadings or headings
of the document.
So we have to modify the org-ehtml to inculcate this feature.

thanks
Nitin Agarwal


On Sun, Oct 28, 2012 at 8:35 PM, Simon Thum  wrote:

> On 10/28/2012 04:19 PM, Eric Schulte wrote:
>
>> Yes, the content of the edit boxes does come from the exported html.
>> For each portion of the Org-mode document (as delimited by
>> org-elements), both the raw Org-mode text and the HTML are exported
>> side-by-side, then the raw Org-mode text is hidden and the HTML is
>> displayed, until the [edit] button is pushed at which point JavaScript
>> is used to hide the HTML and to expose the raw Org-mode text in an edit
>> box.  When edits are committed they are committed one portion (edit-box)
>> at a time.
>>
>> Does this make sense?
>>
>> Why would something need to change for "this" to be reliable?
>>
> No, that sounds correct in principle. But my whitespace got eaten
> nonetheless ;(
>
> I'll be investigating further.
>
> Cheers,
>
> Simon
>
>
>


-- 
*Nitin Agarwal*
Computer Science and Engineering Student
International Institute of Information Technology
Gachibowli, Hyderabad 500 032
Andhra Pradesh, India
Phone : +91-9573572831
E-mail: nitinagarwal3...@gmail.com 
   *nitin.agar...@students.iiit.ac.in*


Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-28 Thread Simon Thum

On 10/28/2012 04:19 PM, Eric Schulte wrote:

Yes, the content of the edit boxes does come from the exported html.
For each portion of the Org-mode document (as delimited by
org-elements), both the raw Org-mode text and the HTML are exported
side-by-side, then the raw Org-mode text is hidden and the HTML is
displayed, until the [edit] button is pushed at which point JavaScript
is used to hide the HTML and to expose the raw Org-mode text in an edit
box.  When edits are committed they are committed one portion (edit-box)
at a time.

Does this make sense?

Why would something need to change for "this" to be reliable?
No, that sounds correct in principle. But my whitespace got eaten 
nonetheless ;(


I'll be investigating further.

Cheers,

Simon




Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-28 Thread Eric Schulte
Simon Thum  writes:

> On 10/22/2012 10:38 PM, Eric Schulte wrote:
>> Simon Thum  writes:
>> --8<---cut here---start->8---
>> foo bar
>>
>>
>>
>>
>>
>> --8<---cut here---end--->8---
>>
>> all of the spaces and newlines are inserted into the Org-mode file.
>> However, when that Org-mode file is re-exported, it uses the normal html
>> exporter (which *does* ignore whitespace by default).
>>
>> So, if you are not having the spaces inserted into your Org-mode file
>> that is a problem with org-ehtml, but if you *are* having the spaces
>> appear in your .org file (server-side), but they are not appearing in
>> the exported HTML, that is expected behavior.
>
> I meant when editing in the HTML page via the server
> call-back. Changing the WS means all lines change, regardless of
> whether I edited them. From your description I assume the edit box
> content comes out of the export, too? I guess that needs to change for
> this to work reliably.
>

Yes, the content of the edit boxes does come from the exported html.
For each portion of the Org-mode document (as delimited by
org-elements), both the raw Org-mode text and the HTML are exported
side-by-side, then the raw Org-mode text is hidden and the HTML is
displayed, until the [edit] button is pushed at which point JavaScript
is used to hide the HTML and to expose the raw Org-mode text in an edit
box.  When edits are committed they are committed one portion (edit-box)
at a time.

Does this make sense?

Why would something need to change for "this" to be reliable?

Thanks,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-24 Thread Simon Thum

On 10/22/2012 10:38 PM, Eric Schulte wrote:

Simon Thum  writes:
--8<---cut here---start->8---
foo bar





--8<---cut here---end--->8---

all of the spaces and newlines are inserted into the Org-mode file.
However, when that Org-mode file is re-exported, it uses the normal html
exporter (which *does* ignore whitespace by default).

So, if you are not having the spaces inserted into your Org-mode file
that is a problem with org-ehtml, but if you *are* having the spaces
appear in your .org file (server-side), but they are not appearing in
the exported HTML, that is expected behavior.


I meant when editing in the HTML page via the server call-back. Changing 
the WS means all lines change, regardless of whether I edited them. From 
your description I assume the edit box content comes out of the export, 
too? I guess that needs to change for this to work reliably.







2) I cannot use the auth handler:



Perhaps you could provide a minimal .el initialization file which shows
how you are trying to launch the server?


Essentially from your README - sadly with -Q it does not work, but I'll 
be back to this in a week or so.


Cheers,

Simon



Hope this Helps,






Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-22 Thread Eric Schulte
Simon Thum  writes:

> Hi Eric,
>
> thank you for this very interesting thing!
>

Happy you're finding this interesting.

>
> I have two comments from my first testing.
> 1) It seems editing is eating all the whitespace in a section. They
> probably need html protection. (  or the like)

I'm not experiencing what I think you're describing.  When I enter say
the following into a text box.

--8<---cut here---start->8---
foo bar  





--8<---cut here---end--->8---

all of the spaces and newlines are inserted into the Org-mode file.
However, when that Org-mode file is re-exported, it uses the normal html
exporter (which *does* ignore whitespace by default).

So, if you are not having the spaces inserted into your Org-mode file
that is a problem with org-ehtml, but if you *are* having the spaces
appear in your .org file (server-side), but they are not appearing in
the exported HTML, that is expected behavior.

> 
> 2) I cannot use the auth handler:
>

Perhaps you could provide a minimal .el initialization file which shows
how you are trying to launch the server?

Hope this Helps,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-21 Thread Simon Thum

Hi Eric,

thank you for this very interesting thing!

I have two comments from my first testing.
1) It seems editing is eating all the whitespace in a section. They 
probably need html protection. (  or the like)

2) I cannot use the auth handler:

signal(error ("Elnode cannot set a wrapper for /login/ on 
org-ehtml-auth-handler"))
  error("Elnode cannot set a wrapper for /login/ on 
org-ehtml-auth-handler")

  elnode-set-wrapper(org-ehtml-auth-handler #[513 "\211\302 (...junk)
  elnode--auth-define-scheme-do-wrap((org-ehtml-auth-handler #[513 " 
(...junk)

require(org-ehtml-auth)
  (progn (require (quote org-ehtml-auth)) (setq 
org-ehtml-everything-editable t org-ehtml-docroot "~/org" 
my-org-ehtml-port ) (elnode-start (quote org-ehtml-auth-handler) 
:port my-org-ehtml-port))
  eval((progn (require (quote org-ehtml-auth)) (setq 
org-ehtml-everything-editable t org-ehtml-docroot "~/org" 
my-org-ehtml-port ) (elnode-start (quote org-ehtml-auth-handler) 
:port my-org-ehtml-port)))
  org-babel-execute:emacs-lisp(";; (require 'org-ehtml)\n(require 
'org-ehtml-auth)\n;; Configure the server\n(setq\n 
org-ehtml-everything-editable t\n org-ehtml-docroot \"~/org\"\n 
my-org-ehtml-port \n )\n\n;; Start the server\n(elnode-start 
'org-ehtml-auth-handler :port my-org-ehtml-port)" ((:comments . "") 
(:shebang . "") (:cache . "no") (:padline . "") (:noweb . "yes") 
(:tangle . "no") (:exports . "code") (:results . "replace") (:session . 
"none") (:padnewline . "yes") (:hlines . "yes") (:colnames . "no") 
(:result-type . value) (:result-params "replace") (:rowname-names) 
(:colname-names)))
  org-babel-execute-src-block(nil ("emacs-lisp" ";; (require 
'org-ehtml)\n(require 'org-ehtml-auth)\n;; Configure the server\n(setq\n 
org-ehtml-everything-editable t\n org-ehtml-docroot \"~/org\"\n 
my-org-ehtml-port \n )\n\n;; Start the server\n(elnode-start 
'org-ehtml-auth-handler :port my-org-ehtml-port)" ((:comments . "") 
(:shebang . "") (:cache . "no") (:padline . "") (:noweb . "yes") 
(:tangle . "no") (:exports . "code") (:results . "replace") (:session . 
"none") (:padnewline . "yes") (:hlines . "yes") (:colnames . "no") 
(:result-type . value) (:result-params "replace") (:rowname-names) 
(:colname-names)) "" nil 0))

  org-babel-execute-src-block-maybe()
  org-babel-execute-maybe()
  org-babel-execute-safely-maybe()


Likely some oversight on my part.

HTH,

Simon


On 08/14/2012 12:28 AM, Eric Schulte wrote:

Hi,

I've recently put together a web server which runs in Emacs and exports
local Org-mode files to HTML in such a way that they may be edited from
within a web browser with the edits saved to local files on disk.  The
code is available from github.

  repository  https://github.com/eschulte/org-ehtml
   README --- http://eschulte.github.com/org-ehtml

This is a very thin Emacs Lisp and JavaScript wrapper around Nic
Ferrier's elnode Emacs web server [1], and Nicolas Goaziou's structured
Org-mode file representation and export engine.  It requires Emacs 24
and the development versions of both Org-mode and elnode.

The code is fairly new so there are likely some kinks to be worked out
(backup your files before editing them with this web-server), but the
implementation is very simple and should be easy to modify.  See the
README for information on how to make use of elnode's authentication
system, or how to have web edits automatically committed to a local
version control system.

Comments and patches are welcome.

Cheers,

Footnotes:
[1]  https://github.com/nicferrier/elnode






Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-04 Thread Eric Schulte
Eric S Fraga  writes:

> Eric Schulte  writes:
>
>> Hi,
>>
>> I've recently put together a web server which runs in Emacs and exports
>> local Org-mode files to HTML in such a way that they may be edited from
>> within a web browser with the edits saved to local files on disk.  The
>> code is available from github.
>
> Eric,
>
> I have been playing with this.  I really like it!
>

Great, I'm happy its working for you, I've been using it myself and
enjoying it.  Hopefully now that it is ELPA installable it will be
easier for more people to try it out.

>
> What I have been testing is how well it interacts with other CSS style
> files.  Some work better than others but, most importantly, they all
> require adding the following:
>
> : #+STYLE:  .raw-org { display: none;} 
>
> to the individual org files so that the content displayed is only the
> html generated by the export.  There may be a better/easier way to
> handle this, of course.
>

Yes, the above is needed to hide the raw Org-mode text until it is
edited.  You can customize the org-ehtml-client-style variable to set
whatever CSS you like as the default.  Similarly it should be fairly
easy for anyone fluent in JavaScript to hack org-ehtml-client-js if they
want to try different behavior.  One of my main goals in writing
org-ehtml was to keep things as small, simple and hackable as possible.

>
> More playing to be done... but I can see this being quite useful!  It
> works really nicely with firefox in combination with a browser plugin
> which allows me to edit the text in the boxes using emacsclient (with
> org mode enabled!).
>

Oh great, I used to use that same browser plugin, but for the last year
or so I've gone whole hog and switched to using conkeror as my web
browser. http://conkeror.org/

>
> thanks (and to Nic as well for elnode),
> eric

Cheers,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-10-01 Thread Eric S Fraga
Eric Schulte  writes:

> Hi,
>
> I've recently put together a web server which runs in Emacs and exports
> local Org-mode files to HTML in such a way that they may be edited from
> within a web browser with the edits saved to local files on disk.  The
> code is available from github.

Eric,

I have been playing with this.  I really like it!

What I have been testing is how well it interacts with other CSS style
files.  Some work better than others but, most importantly, they all
require adding the following:

: #+STYLE:  .raw-org { display: none;} 

to the individual org files so that the content displayed is only the
html generated by the export.  There may be a better/easier way to
handle this, of course.

More playing to be done... but I can see this being quite useful!  It
works really nicely with firefox in combination with a browser plugin
which allows me to edit the text in the boxes using emacsclient (with
org mode enabled!).

thanks (and to Nic as well for elnode),
eric
-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.2.50.1 and Org release_7.9.2-360-g2a95a4




Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Ista Zahn
On Thu, Aug 16, 2012 at 4:11 PM, Eric Schulte  wrote:
>>
>>
>> All is working as expected, and as expected it's really cool. Thank you!
>>
>
> Great, happy its working.
>
>>
>> Now if I could just edit babel source blocks and have the results
>> blocks update on the fly I would be in R workshop presenter heaven.
>> Any chance of this sort of thing down the road?
>>
>
> Yea, I haven't implemented an edit interface for code blocks yet.  As
> you suggest I think that they could benefit from a customized edit
> interface, luckily Nicolas' org-export makes element-specific exports
> easy to implement.
>
> I'm not sure what sort of interaction would be best...
> - would a [RUN] button be useful
> - should just the body of the code block be editable, or everything
> - should code block results have a re-run button

Personally I would like to see it work pretty much the same as other
editable elements, except that it would re-run the code and update the
results block. So you could just

1) click to edit the source block
2) make changes to the code
3) click save

and any results block would be updated to the result of your changes in step 2.


Best,
Ista
>
> No solution has jumped out yet, so I'm just wanting till something seems
> obvious.  If you have more specific ideas I'd love to hear them.  I
> think something like Python's notebooks should be fairly easy to
> implement.
>
> Cheers,
>
>>
>>>
>>> Best,
>>>

 Best,
 Ista

>
> Thanks,
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte

>>>
>>> --
>>> Eric Schulte
>>> http://cs.unm.edu/~eschulte
>>
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Eric Schulte
Achim Gratz  writes:

> Eric Schulte writes:
>> Ugh, this is more headache related to the renaming of all cl-* functions
>> between the released version of Emacs 24 and the development head of
>> Emacs (which I'm using).  I've just pushed up a change after which all
>> tests are passing on both the development head and the released version
>> of Emacs 24.
>
> Note that there's yet a new wrinkle with the upcoming release of the
> 24.2 version (which hasn't made the change yet), so 24.1.50 and
> 24.2.50 and later have new-style cl libraries...
>

Ah, good to know thanks.  I guess I should catch up on my emacs-dev
reading.

Cheers,

>
>
> Regards,
> Achim.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Eric Schulte
>
>
> All is working as expected, and as expected it's really cool. Thank you!
>

Great, happy its working.

>
> Now if I could just edit babel source blocks and have the results
> blocks update on the fly I would be in R workshop presenter heaven.
> Any chance of this sort of thing down the road?
>

Yea, I haven't implemented an edit interface for code blocks yet.  As
you suggest I think that they could benefit from a customized edit
interface, luckily Nicolas' org-export makes element-specific exports
easy to implement.

I'm not sure what sort of interaction would be best...
- would a [RUN] button be useful
- should just the body of the code block be editable, or everything
- should code block results have a re-run button

No solution has jumped out yet, so I'm just wanting till something seems
obvious.  If you have more specific ideas I'd love to hear them.  I
think something like Python's notebooks should be fairly easy to
implement.

Cheers,

>
>>
>> Best,
>>
>>>
>>> Best,
>>> Ista
>>>

 Thanks,

 --
 Eric Schulte
 http://cs.unm.edu/~eschulte
>>>
>>
>> --
>> Eric Schulte
>> http://cs.unm.edu/~eschulte
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Ista Zahn
On Thu, Aug 16, 2012 at 12:36 PM, Eric Schulte  wrote:
> Ista Zahn  writes:
>
>> On Thu, Aug 16, 2012 at 2:31 AM, Eric Schulte  wrote:
>>> Ista Zahn  writes:
>>>
 Hi Eric,

 Sounds really cool, I'd love to try it out. But when I run (ert
 "org-ehtml") I get errors like

 Selector: "org-ehtml"
 Passed: 0
 Failed: 5 (5 unexpected)
 Total:  5/6

 Started at:   2012-08-15 22:00:20-0400
 Finished.
 Finished at:  2012-08-15 22:00:50-0400

 FFQFFF

 F org-ehtml-elnode-serve-all-editable
 (void-function cl-flet)

 F org-ehtml-elnode-serve-complex
 (void-function cl-flet)

 Q org-ehtml-elnode-serve-simple
 (quit)

 F org-ehtml-export-file
 (void-variable org-export-with-LaTeX-fragments)

 F org-ehtml-post-request
 (error "Shell command in progress")

 F org-ehtml-simple-export
 (void-variable org-export-with-LaTeX-fragments)

 This is with the git version of org and emacs 24.1.1

 Any ideas what I might have missed?

 Thanks,
 Ista

>>>
>>> Ah, thanks for sharing this output, it looks like I wasn't careful
>>> enough about ensuring that cl-lib was loaded.  I've added a number of
>>> require statements which should fix the error you pointed out above.
>>>
>>> Please grab the latest from git, and let me know if these problems
>>> persist or any new issues assert themselves.
>>
>> With the current git version I now get "File error: Cannot open load
>> file, cl-lib" on start up.
>>
>> find / -name cl-lib.el does not produce any results on my machine, nor
>> have I been able to find it in elpa/marmalade etc. Google search
>> suggests it is built in with emacs, but I'm pretty sure I don't have
>> it...
>>
>
> Ugh, this is more headache related to the renaming of all cl-* functions
> between the released version of Emacs 24 and the development head of
> Emacs (which I'm using).  I've just pushed up a change after which all
> tests are passing on both the development head and the released version
> of Emacs 24.
>
> Thanks for your help in running this down.


All is working as expected, and as expected it's really cool. Thank you!

Now if I could just edit babel source blocks and have the results
blocks update on the fly I would be in R workshop presenter heaven.
Any chance of this sort of thing down the road?

>
> Best,
>
>>
>> Best,
>> Ista
>>
>>>
>>> Thanks,
>>>
>>> --
>>> Eric Schulte
>>> http://cs.unm.edu/~eschulte
>>
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Achim Gratz
Eric Schulte writes:
> Ugh, this is more headache related to the renaming of all cl-* functions
> between the released version of Emacs 24 and the development head of
> Emacs (which I'm using).  I've just pushed up a change after which all
> tests are passing on both the development head and the released version
> of Emacs 24.

Note that there's yet a new wrinkle with the upcoming release of the
24.2 version (which hasn't made the change yet), so 24.1.50 and
24.2.50 and later have new-style cl libraries...


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Eric Schulte
Ista Zahn  writes:

> On Thu, Aug 16, 2012 at 2:31 AM, Eric Schulte  wrote:
>> Ista Zahn  writes:
>>
>>> Hi Eric,
>>>
>>> Sounds really cool, I'd love to try it out. But when I run (ert
>>> "org-ehtml") I get errors like
>>>
>>> Selector: "org-ehtml"
>>> Passed: 0
>>> Failed: 5 (5 unexpected)
>>> Total:  5/6
>>>
>>> Started at:   2012-08-15 22:00:20-0400
>>> Finished.
>>> Finished at:  2012-08-15 22:00:50-0400
>>>
>>> FFQFFF
>>>
>>> F org-ehtml-elnode-serve-all-editable
>>> (void-function cl-flet)
>>>
>>> F org-ehtml-elnode-serve-complex
>>> (void-function cl-flet)
>>>
>>> Q org-ehtml-elnode-serve-simple
>>> (quit)
>>>
>>> F org-ehtml-export-file
>>> (void-variable org-export-with-LaTeX-fragments)
>>>
>>> F org-ehtml-post-request
>>> (error "Shell command in progress")
>>>
>>> F org-ehtml-simple-export
>>> (void-variable org-export-with-LaTeX-fragments)
>>>
>>> This is with the git version of org and emacs 24.1.1
>>>
>>> Any ideas what I might have missed?
>>>
>>> Thanks,
>>> Ista
>>>
>>
>> Ah, thanks for sharing this output, it looks like I wasn't careful
>> enough about ensuring that cl-lib was loaded.  I've added a number of
>> require statements which should fix the error you pointed out above.
>>
>> Please grab the latest from git, and let me know if these problems
>> persist or any new issues assert themselves.
>
> With the current git version I now get "File error: Cannot open load
> file, cl-lib" on start up.
>
> find / -name cl-lib.el does not produce any results on my machine, nor
> have I been able to find it in elpa/marmalade etc. Google search
> suggests it is built in with emacs, but I'm pretty sure I don't have
> it...
>

Ugh, this is more headache related to the renaming of all cl-* functions
between the released version of Emacs 24 and the development head of
Emacs (which I'm using).  I've just pushed up a change after which all
tests are passing on both the development head and the released version
of Emacs 24.

Thanks for your help in running this down.

Best,

>
> Best,
> Ista
>
>>
>> Thanks,
>>
>> --
>> Eric Schulte
>> http://cs.unm.edu/~eschulte
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Ista Zahn
On Thu, Aug 16, 2012 at 2:31 AM, Eric Schulte  wrote:
> Ista Zahn  writes:
>
>> Hi Eric,
>>
>> Sounds really cool, I'd love to try it out. But when I run (ert
>> "org-ehtml") I get errors like
>>
>> Selector: "org-ehtml"
>> Passed: 0
>> Failed: 5 (5 unexpected)
>> Total:  5/6
>>
>> Started at:   2012-08-15 22:00:20-0400
>> Finished.
>> Finished at:  2012-08-15 22:00:50-0400
>>
>> FFQFFF
>>
>> F org-ehtml-elnode-serve-all-editable
>> (void-function cl-flet)
>>
>> F org-ehtml-elnode-serve-complex
>> (void-function cl-flet)
>>
>> Q org-ehtml-elnode-serve-simple
>> (quit)
>>
>> F org-ehtml-export-file
>> (void-variable org-export-with-LaTeX-fragments)
>>
>> F org-ehtml-post-request
>> (error "Shell command in progress")
>>
>> F org-ehtml-simple-export
>> (void-variable org-export-with-LaTeX-fragments)
>>
>> This is with the git version of org and emacs 24.1.1
>>
>> Any ideas what I might have missed?
>>
>> Thanks,
>> Ista
>>
>
> Ah, thanks for sharing this output, it looks like I wasn't careful
> enough about ensuring that cl-lib was loaded.  I've added a number of
> require statements which should fix the error you pointed out above.
>
> Please grab the latest from git, and let me know if these problems
> persist or any new issues assert themselves.

With the current git version I now get "File error: Cannot open load
file, cl-lib" on start up.

find / -name cl-lib.el does not produce any results on my machine, nor
have I been able to find it in elpa/marmalade etc. Google search
suggests it is built in with emacs, but I'm pretty sure I don't have
it...

Best,
Ista

>
> Thanks,
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Eric Schulte
>>
>> This must be a JavaScript issue related to some difference between
>>browsers.  Can I ask, what browser you are using?  I've done all of my
>>testing with browsers in the Firefox family (Firefox and conkeror).
>
> I'm using the version of Chrome provided by Arch linux, it tells me
> Version 21.0.1180.79 (151411). I just tried the test server in Firefox,
> and it worked perfectly.
>
> Much as I like Chrome, I've occasionally seen it make websites fail in
> ways you wouldn't think a browser should be capable of.

Good to know thanks.  I'll make a note of this and take a look at it
when next I have some free time.  My Java Script is not strong, so maybe
there is a more inter-operable way to write this file.  If anyone has
Java Script and JQuery experience and wants to take a look the problem
is around line 14 of src/org-ehtml-client.js.

Thanks,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Eric Abrahamsen
On Thu, Aug 16 2012, Eric Schulte wrote:

> Eric Abrahamsen  writes:
>
>> On Thu, Aug 16 2012, Eric Schulte wrote:
>>
>>> Eric Abrahamsen  writes:
>>>
 On Thu, Aug 16 2012, Eric Schulte wrote:

>>> Every time I edited a block and clicked "save", it just deleted the
>>> whole block. I got these errors in ~/.elnodelogs/elnode-error:
>>>
>>
>> I'm not sure what could be causing this problem.  Did the test suite run
>> successfully for you?
>
> I've now added a POST test to the test suite.  So if your problem
> persists you should now see a failing test, and conversely if you are
> now passing the test suite this problem should be eliminated.

 So yes, I did run the tests the first time, and you're right that,
 without the "post" test, they went just fine. The documents were also
 altered on-disk (ie, the chunks really were deleted).
>>>
>>> Interesting.
>>
>> [...]
>>
>>> Even thought this test is failing, it does show that your elnode server
>>> is returning the HTML in response to your POST requests.  It looks like
>>> it only fails because your Emacs exports *foo* as foo instead
>>> of as foo.
>>>

 Then I restarted emacs -Q and used your batch.el file. I'm still getting
 the same problem, unfortunately: the editable blocks disappear when I
 hit "save". I realized I don't actually know whether this is supposed to
 edit the simple.org or simple.html files:
>>>
>>
>> [...]
>>
>>> I've just pushed up some changes to the git repository which add new
>>> require statements.  Hopefully the errors above were caused by some
>>> required functions not being loaded at run time.  If the newest from git
>>> doesn't work fix these problems, please try running
>>>
>>>   emacs -Q -l batch.el
>>>
>>> with this updated version of batch.el, and let me know what is printed
>>> in the *Messages* buffer in the line which starts as "params:".
>>
>> The same test failed in the same way,
>
> Fair enough, this must be a legitimate difference in our HTML export,
> I'll make the test appropriately more permissive.
>
>> so I loaded up the new batch.el file, and here's the "params" line:
>>
>> params:(("path" . "/simple.org") ("end" . "577") ("beg" . "156") ("org"
>> . ""))
>>
>> Hope that's enlightening!
>>
>
> Yes, very enlightening.  It means that the server-side and Emacs Lisp
> side are working as expected.  However, for some reason, when you hit
> [SAVE] the information submitted by your browser includes an empty text
> field (this is the "org" pair above).
>
> This must be a JavaScript issue related to some difference between
> browsers.  Can I ask, what browser you are using?  I've done all of my
> testing with browsers in the Firefox family (Firefox and conkeror).

I'm using the version of Chrome provided by Arch linux, it tells me
Version 21.0.1180.79 (151411). I just tried the test server in Firefox,
and it worked perfectly.

Much as I like Chrome, I've occasionally seen it make websites fail in
ways you wouldn't think a browser should be capable of.


-- 
GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.11) of
 2012-08-14 on pellet 7.8.11




Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Eric Schulte
Eric Abrahamsen  writes:

> On Thu, Aug 16 2012, Eric Schulte wrote:
>
>> Eric Abrahamsen  writes:
>>
>>> On Thu, Aug 16 2012, Eric Schulte wrote:
>>>
>> Every time I edited a block and clicked "save", it just deleted the
>> whole block. I got these errors in ~/.elnodelogs/elnode-error:
>>
>
> I'm not sure what could be causing this problem.  Did the test suite run
> successfully for you?

 I've now added a POST test to the test suite.  So if your problem
 persists you should now see a failing test, and conversely if you are
 now passing the test suite this problem should be eliminated.
>>>
>>> So yes, I did run the tests the first time, and you're right that,
>>> without the "post" test, they went just fine. The documents were also
>>> altered on-disk (ie, the chunks really were deleted).
>>
>> Interesting.
>
> [...]
>
>> Even thought this test is failing, it does show that your elnode server
>> is returning the HTML in response to your POST requests.  It looks like
>> it only fails because your Emacs exports *foo* as foo instead
>> of as foo.
>>
>>>
>>> Then I restarted emacs -Q and used your batch.el file. I'm still getting
>>> the same problem, unfortunately: the editable blocks disappear when I
>>> hit "save". I realized I don't actually know whether this is supposed to
>>> edit the simple.org or simple.html files:
>>
>
> [...]
>
>> I've just pushed up some changes to the git repository which add new
>> require statements.  Hopefully the errors above were caused by some
>> required functions not being loaded at run time.  If the newest from git
>> doesn't work fix these problems, please try running
>>
>>   emacs -Q -l batch.el
>>
>> with this updated version of batch.el, and let me know what is printed
>> in the *Messages* buffer in the line which starts as "params:".
>
> The same test failed in the same way,

Fair enough, this must be a legitimate difference in our HTML export,
I'll make the test appropriately more permissive.

> so I loaded up the new batch.el file, and here's the "params" line:
>
> params:(("path" . "/simple.org") ("end" . "577") ("beg" . "156") ("org"
> . ""))
>
> Hope that's enlightening!
>

Yes, very enlightening.  It means that the server-side and Emacs Lisp
side are working as expected.  However, for some reason, when you hit
[SAVE] the information submitted by your browser includes an empty text
field (this is the "org" pair above).

This must be a JavaScript issue related to some difference between
browsers.  Can I ask, what browser you are using?  I've done all of my
testing with browsers in the Firefox family (Firefox and conkeror).

Thanks!

>
> E

-- 
Eric Schulte
http://cs.unm.edu/~eschulte




Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-16 Thread Eric Abrahamsen
On Thu, Aug 16 2012, Eric Schulte wrote:

> Eric Abrahamsen  writes:
>
>> On Thu, Aug 16 2012, Eric Schulte wrote:
>>
> Every time I edited a block and clicked "save", it just deleted the
> whole block. I got these errors in ~/.elnodelogs/elnode-error:
>

 I'm not sure what could be causing this problem.  Did the test suite run
 successfully for you?
>>>
>>> I've now added a POST test to the test suite.  So if your problem
>>> persists you should now see a failing test, and conversely if you are
>>> now passing the test suite this problem should be eliminated.
>>
>> So yes, I did run the tests the first time, and you're right that,
>> without the "post" test, they went just fine. The documents were also
>> altered on-disk (ie, the chunks really were deleted).
>
> Interesting.

[...]

> Even thought this test is failing, it does show that your elnode server
> is returning the HTML in response to your POST requests.  It looks like
> it only fails because your Emacs exports *foo* as foo instead
> of as foo.
>
>>
>> Then I restarted emacs -Q and used your batch.el file. I'm still getting
>> the same problem, unfortunately: the editable blocks disappear when I
>> hit "save". I realized I don't actually know whether this is supposed to
>> edit the simple.org or simple.html files:
>

[...]

> I've just pushed up some changes to the git repository which add new
> require statements.  Hopefully the errors above were caused by some
> required functions not being loaded at run time.  If the newest from git
> doesn't work fix these problems, please try running
>
>   emacs -Q -l batch.el
>
> with this updated version of batch.el, and let me know what is printed
> in the *Messages* buffer in the line which starts as "params:".

The same test failed in the same way, so I loaded up the new batch.el
file, and here's the "params" line:

params:(("path" . "/simple.org") ("end" . "577") ("beg" . "156") ("org"
. ""))

Hope that's enlightening!

E

-- 
GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.11)
 of 2012-08-14 on pellet
7.8.11




Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-15 Thread Eric Schulte
Eric Abrahamsen  writes:

> On Thu, Aug 16 2012, Eric Schulte wrote:
>
 Every time I edited a block and clicked "save", it just deleted the
 whole block. I got these errors in ~/.elnodelogs/elnode-error:

>>>
>>> I'm not sure what could be causing this problem.  Did the test suite run
>>> successfully for you?
>>
>> I've now added a POST test to the test suite.  So if your problem
>> persists you should now see a failing test, and conversely if you are
>> now passing the test suite this problem should be eliminated.
>
> So yes, I did run the tests the first time, and you're right that,
> without the "post" test, they went just fine. The documents were also
> altered on-disk (ie, the chunks really were deleted).

Interesting.

> I updated org-ehtml to get the new tests, and the "post" test failed
> thusly:
>
> --8<---cut here---start->8---
> F org-ehtml-post-request
> (ert-test-failed
>  ((should
>(string-match "foo" html))
>   :form
>   (string-match "foo"
>   #("\nfoo\n" 0 17
> (fontified t front-sticky
>(field inhibit-line-move-field-capture)
>rear-nonsticky t field output 
> inhibit-line-move-field-capture t)
> 17 21
> (fontified t front-sticky
>(field inhibit-line-move-field-capture)
>rear-nonsticky t field output 
> inhibit-line-move-field-capture t)))
>   :value nil))
> --8<---cut here---end--->8---
>
> This is still with my regular emacs environment.
>

Even thought this test is failing, it does show that your elnode server
is returning the HTML in response to your POST requests.  It looks like
it only fails because your Emacs exports *foo* as foo instead
of as foo.

>
> Then I restarted emacs -Q and used your batch.el file. I'm still getting
> the same problem, unfortunately: the editable blocks disappear when I
> hit "save". I realized I don't actually know whether this is supposed to
> edit the simple.org or simple.html files:

Edits are applied to the simple.org file itself.  The simple.html file
will not be updated until you refresh the page through your web browser.

> anyway, the text disappears from the org file, but not from the html
> file. Here's the output of *Messages*:
>
[...]

Nothing here looks odd.

>
> And the elnode error file:
>
[...]

The elnode error output don't generally contain anything interesting.
Instead of listing errors it just lists routine access.

I've just pushed up some changes to the git repository which add new
require statements.  Hopefully the errors above were caused by some
required functions not being loaded at run time.  If the newest from git
doesn't work fix these problems, please try running

  emacs -Q -l batch.el

with this updated version of batch.el, and let me know what is printed
in the *Messages* buffer in the line which starts as "params:".



batch.el
Description: application/emacs-lisp

Thanks,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte


Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-15 Thread Eric Schulte
Ista Zahn  writes:

> Hi Eric,
>
> Sounds really cool, I'd love to try it out. But when I run (ert
> "org-ehtml") I get errors like
>
> Selector: "org-ehtml"
> Passed: 0
> Failed: 5 (5 unexpected)
> Total:  5/6
>
> Started at:   2012-08-15 22:00:20-0400
> Finished.
> Finished at:  2012-08-15 22:00:50-0400
>
> FFQFFF
>
> F org-ehtml-elnode-serve-all-editable
> (void-function cl-flet)
>
> F org-ehtml-elnode-serve-complex
> (void-function cl-flet)
>
> Q org-ehtml-elnode-serve-simple
> (quit)
>
> F org-ehtml-export-file
> (void-variable org-export-with-LaTeX-fragments)
>
> F org-ehtml-post-request
> (error "Shell command in progress")
>
> F org-ehtml-simple-export
> (void-variable org-export-with-LaTeX-fragments)
>
> This is with the git version of org and emacs 24.1.1
>
> Any ideas what I might have missed?
>
> Thanks,
> Ista
>

Ah, thanks for sharing this output, it looks like I wasn't careful
enough about ensuring that cl-lib was loaded.  I've added a number of
require statements which should fix the error you pointed out above.

Please grab the latest from git, and let me know if these problems
persist or any new issues assert themselves.

Thanks,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-15 Thread Eric Abrahamsen
On Thu, Aug 16 2012, Eric Schulte wrote:

>>> Every time I edited a block and clicked "save", it just deleted the
>>> whole block. I got these errors in ~/.elnodelogs/elnode-error:
>>>
>>
>> I'm not sure what could be causing this problem.  Did the test suite run
>> successfully for you?
>
> I've now added a POST test to the test suite.  So if your problem
> persists you should now see a failing test, and conversely if you are
> now passing the test suite this problem should be eliminated.

So yes, I did run the tests the first time, and you're right that,
without the "post" test, they went just fine. The documents were also
altered on-disk (ie, the chunks really were deleted). I updated
org-ehtml to get the new tests, and the "post" test failed thusly:

--8<---cut here---start->8---
F org-ehtml-post-request
(ert-test-failed
 ((should
   (string-match "foo" html))
  :form
  (string-match "foo"
#("\nfoo\n" 0 17
  (fontified t front-sticky
 (field inhibit-line-move-field-capture)
 rear-nonsticky t field output 
inhibit-line-move-field-capture t)
  17 21
  (fontified t front-sticky
 (field inhibit-line-move-field-capture)
 rear-nonsticky t field output 
inhibit-line-move-field-capture t)))
  :value nil))
--8<---cut here---end--->8---

This is still with my regular emacs environment.

Then I restarted emacs -Q and used your batch.el file. I'm still getting
the same problem, unfortunately: the editable blocks disappear when I
hit "save". I realized I don't actually know whether this is supposed to
edit the simple.org or simple.html files: anyway, the text disappears
from the org file, but not from the html file. Here's the output of
*Messages*:

--8<---cut here---start->8---
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set [2 times]
deleting server process
Added to /home/eric/.elnodelogs/elnode-error
found the server process - NOT deleting
Added to /home/eric/.elnodelogs/elnode-error
-start-relevant-output-
Added to /home/eric/.elnodelogs/elnode-error [5 times]
Added to /home/eric/.elnodelogs/org-ehtml
Added to /home/eric/.elnodelogs/elnode-error [11 times]
Added to /home/eric/.elnodelogs/org-ehtml
Added to /home/eric/.elnodelogs/elnode-error [9 times]
Added to /home/eric/.elnodelogs/org-ehtml
OVERVIEW
Loading vc-git...done
Saving file /home/eric/.emacs.d/org-ehtml/test/examples/simple.org...
Wrote /home/eric/.emacs.d/org-ehtml/test/examples/simple.org
Added to /home/eric/.elnodelogs/elnode-error
Saving file /tmp/org-22133iXI...
Wrote /tmp/org-22133iXI
OVERVIEW
Exporting... [2 times]
HTML export done, pushed to kill ring and clipboard
Added to /home/eric/.elnodelogs/elnode-error [8 times]
Added to /home/eric/.elnodelogs/org-ehtml
OVERVIEW
Saving file /home/eric/.emacs.d/org-ehtml/test/examples/simple.org...
Wrote /home/eric/.emacs.d/org-ehtml/test/examples/simple.org
Added to /home/eric/.elnodelogs/elnode-error
Saving file /tmp/org-22133vhO...
Wrote /tmp/org-22133vhO
Exporting... [2 times]
HTML export done, pushed to kill ring and clipboard
Added to /home/eric/.elnodelogs/elnode-error [5 times]
Making completion list...
deleting server process  ; here I called (elnode-stop ) explicitly)
Added to /home/eric/.elnodelogs/elnode-error
found the server process - NOT deleting
Added to /home/eric/.elnodelogs/elnode-error
nil
--8<---cut here---end--->8---

And the elnode error file:

--8<---cut here---start->8---
20120816123716: elnode--sentinel 'deleted.' for process  
*elnode-webserver-proc* with buffer *elnode-webserver*
20120816123716: Elnode server stopped
20120816123751: elnode--sentinel 'open from 127.0.0.1.' for process  
*elnode-webserver-proc* <127.0.0.1:41647> with buffer nil
20120816123751: Elnode status: *elnode-webserver-proc* <127.0.0.1:41647> open 
from 127.0.0.1
20120816123751: elnode--sentinel 'open from 127.0.0.1.' for process  
*elnode-webserver-proc* <127.0.0.1:41649> with buffer nil
20120816123752: Elnode status: *elnode-webserver-proc* <127.0.0.1:41649> open 
from 127.0.0.1
20120816123752: filter: calling handler on *elnode-webserver-proc* 
<127.0.0.1:41647>
20120816123752: starting HTTP response on *elnode-webserver-proc* 
<127.0.0.1:41647>
20120816123752: Elnode-child-process init *elnode-webserver-proc* 
<127.0.0.1:41647>
20120816123752: filter: handler returned on *elnode-webserver-proc* 
<127.0.0.1:41647>
20120816123752: Elnode-child-process-filter http state: open data length: 4096 
on *elnode-webserver-proc* <127.0.0.1:41647>
20120816123752: Elnode-child-process-filter http state: open data length: 4096 
on *

Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-15 Thread Ista Zahn
Hi Eric,

Sounds really cool, I'd love to try it out. But when I run (ert
"org-ehtml") I get errors like

Selector: "org-ehtml"
Passed: 0
Failed: 5 (5 unexpected)
Total:  5/6

Started at:   2012-08-15 22:00:20-0400
Finished.
Finished at:  2012-08-15 22:00:50-0400

FFQFFF

F org-ehtml-elnode-serve-all-editable
(void-function cl-flet)

F org-ehtml-elnode-serve-complex
(void-function cl-flet)

Q org-ehtml-elnode-serve-simple
(quit)

F org-ehtml-export-file
(void-variable org-export-with-LaTeX-fragments)

F org-ehtml-post-request
(error "Shell command in progress")

F org-ehtml-simple-export
(void-variable org-export-with-LaTeX-fragments)

This is with the git version of org and emacs 24.1.1

Any ideas what I might have missed?

Thanks,
Ista

On Mon, Aug 13, 2012 at 6:28 PM, Eric Schulte  wrote:
> Hi,
>
> I've recently put together a web server which runs in Emacs and exports
> local Org-mode files to HTML in such a way that they may be edited from
> within a web browser with the edits saved to local files on disk.  The
> code is available from github.
>
>  repository  https://github.com/eschulte/org-ehtml
>   README --- http://eschulte.github.com/org-ehtml
>
> This is a very thin Emacs Lisp and JavaScript wrapper around Nic
> Ferrier's elnode Emacs web server [1], and Nicolas Goaziou's structured
> Org-mode file representation and export engine.  It requires Emacs 24
> and the development versions of both Org-mode and elnode.
>
> The code is fairly new so there are likely some kinks to be worked out
> (backup your files before editing them with this web-server), but the
> implementation is very simple and should be easy to modify.  See the
> README for information on how to make use of elnode's authentication
> system, or how to have web edits automatically committed to a local
> version control system.
>
> Comments and patches are welcome.
>
> Cheers,
>
> Footnotes:
> [1]  https://github.com/nicferrier/elnode
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte
>



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-15 Thread Eric Schulte
>> Every time I edited a block and clicked "save", it just deleted the
>> whole block. I got these errors in ~/.elnodelogs/elnode-error:
>>
>
> I'm not sure what could be causing this problem.  Did the test suite run
> successfully for you?

I've now added a POST test to the test suite.  So if your problem
persists you should now see a failing test, and conversely if you are
now passing the test suite this problem should be eliminated.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-15 Thread Eric Schulte
Bastien  writes:

> Hi Eric,
>
> Eric Schulte  writes:
>
>> With respect to security, elnode has a simple authentication system
>> which seems to work well in my local trials.  It has no forms for
>> setting passwords online, so users would have to generate a hash of
>> their password locally, and then send the hash to someone who would
>> manually add it to the elnode authentication database on orgmode.org.
>>
>> During authentication the hashed password is sent in plain text, so we
>> would need to run the elnode server behind an https proxy server.  I
>> don't think this would be difficult to implement and is a good idea for
>> any system with authentication.
>
> Thanks for those details.
>
>> With respect to integration with the existing Worg, this system should
>> work well in concert with the git backend.  Git could still be used for
>> offline edits as it is currently.  The org-ehtml server could be
>> configured to commit all web edits to git.  A conflict checker would be
>> needed, which could be added to the `org-ehtml-before-save-hook'.
>
> I think a page should be locked when a user is editing it through
> org-ehtml.el.  This would prevent conflicts from concurrent editing
> from the web.
>
> As for conflicts between the .org to be written (from org-ehtml) and 
> the .org that might have been pushed trough git, what would be the
> behavior?  Discard this edit?  Use org-merge-driver to help resolve
> the conflict?  Let the user download the .org he has been editing, 
> so that his changes are not lost?
>

I haven't given this much thought, but my first instinct is to avoid any
use of locking.  I think the conflict resolution model used by version
control systems could also be appropriate here.  Namely, the first to
commit an edit has their edit applied, and any subsequent out-of-date
edits are merged.

- if the backend VC system is able to automatically merge the edit, then
  this will be done automatically.  The probability of a successful
  merge becomes more likely if the new org-merge engine is used by the
  backing VC system.

- if such a merge is not possible, then the edited version should be
  saved in some way.  maybe this data should be presented to the user in
  a plain text block or as a file download (depending on edit size).
  The user could then refresh the org page to get the new version and
  manually incorporate their edit.

- if at some point in the hazy distant future someone builds a simple
  elnode web interface to ediff, then that could be used to perform live
  merges of files.  Such a system would boast better conflict handling
  than any existing wiki system of which I'm currently aware.

>
> This is still quite unclear to me.
>
> In any case, we should first try this on a prototype for a while and 
> see if this is robust enough.

I absolutely agree, this is not yet ready for Worg.  After we figure out
good answers to the above we can try a test run in a sandbox, and then
possibly migrate to Worg only after we're convinced this is stable.

I view org-ehtml as an opportunistic integration of a confluence of
developments in elnode and org-element.  While I think it is an elegant
design and has a lot of potential I wouldn't call it a production-ready
system.

Thanks

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-15 Thread Eric Schulte
Eric Abrahamsen  writes:

> On Tue, Aug 14 2012, Eric Schulte wrote:
>
>> Hi,
>>
>> I've recently put together a web server which runs in Emacs and exports
>> local Org-mode files to HTML in such a way that they may be edited from
>> within a web browser with the edits saved to local files on disk.  The
>> code is available from github.
>>
>>  repository  https://github.com/eschulte/org-ehtml
>>   README --- http://eschulte.github.com/org-ehtml
>>
>> This is a very thin Emacs Lisp and JavaScript wrapper around Nic
>> Ferrier's elnode Emacs web server [1], and Nicolas Goaziou's structured
>> Org-mode file representation and export engine.  It requires Emacs 24
>> and the development versions of both Org-mode and elnode.
>>
>> The code is fairly new so there are likely some kinks to be worked out
>> (backup your files before editing them with this web-server), but the
>> implementation is very simple and should be easy to modify.  See the
>> README for information on how to make use of elnode's authentication
>> system, or how to have web edits automatically committed to a local
>> version control system.
>
> I gave this a very brief whirl, with the dev versions of emacs, org,
> elnode, and org-ehtml, and running the test server on simple.org as
> described in the README. Every time I edited a block and clicked "save",
> it just deleted the whole block. I got these errors in
> ~/.elnodelogs/elnode-error:
>

I'm not sure what could be causing this problem.  Did the test suite run
successfully for you?  I'm betting it did if the problem didn't arise
until you POSTed save data.  Was the block deleted from the Org-mode
file on disk, or just from the web page?  What happens when you refresh
the web page after an edit?

>
> I'd be happy to mess with this further if it would be helpful.
>

This would be very helpful as I can't reproduce the problem locally.

Please re-run with emacs -Q using the attached batch.el ELisp file.
Instructions for re-running are included in the top of the file.  This
will re-run on your system with a minimal configuration, and will stifle
the elnode warning (which are uniformly unhelpful).



batch.el
Description: application/emacs-lisp

When I run this locally, I get the following output in my *Messages*
buffer.

,[*Messages*]
| -start-relevant-output-
| Added to /home/eschulte/.elnodelogs/elnode-error [3 times]
| Added to /home/eschulte/.elnodelogs/org-ehtml
| OVERVIEW
| Loading vc-git...done
| Saving file /home/eschulte/.emacs.d/src/org-ehtml/test/examples/simple.html...
| Wrote /home/eschulte/.emacs.d/src/org-ehtml/test/examples/simple.html
| Added to /home/eschulte/.elnodelogs/elnode-error [13 times]
| Added to /home/eschulte/.elnodelogs/org-ehtml
| Saving file /home/eschulte/.emacs.d/src/org-ehtml/test/examples/simple.org...
| Wrote /home/eschulte/.emacs.d/src/org-ehtml/test/examples/simple.org
| Added to /home/eschulte/.elnodelogs/elnode-error
| Saving file /tmp/org-11503Cdz...
| Wrote /tmp/org-11503Cdz
| OVERVIEW
| Exporting... [2 times]
| HTML export done, pushed to kill ring and clipboard
| Added to /home/eschulte/.elnodelogs/elnode-error [5 times]
`

If this doesn't solve the problem I can send a modified version of the
attached batch.el file which will include more debug output.

Thanks,

>
> E

-- 
Eric Schulte
http://cs.unm.edu/~eschulte


Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-14 Thread Eric Abrahamsen
On Tue, Aug 14 2012, Eric Schulte wrote:

> Hi,
>
> I've recently put together a web server which runs in Emacs and exports
> local Org-mode files to HTML in such a way that they may be edited from
> within a web browser with the edits saved to local files on disk.  The
> code is available from github.
>
>  repository  https://github.com/eschulte/org-ehtml
>   README --- http://eschulte.github.com/org-ehtml
>
> This is a very thin Emacs Lisp and JavaScript wrapper around Nic
> Ferrier's elnode Emacs web server [1], and Nicolas Goaziou's structured
> Org-mode file representation and export engine.  It requires Emacs 24
> and the development versions of both Org-mode and elnode.
>
> The code is fairly new so there are likely some kinks to be worked out
> (backup your files before editing them with this web-server), but the
> implementation is very simple and should be easy to modify.  See the
> README for information on how to make use of elnode's authentication
> system, or how to have web edits automatically committed to a local
> version control system.

I gave this a very brief whirl, with the dev versions of emacs, org,
elnode, and org-ehtml, and running the test server on simple.org as
described in the README. Every time I edited a block and clicked "save",
it just deleted the whole block. I got these errors in
~/.elnodelogs/elnode-error:

20120814213846: elnode--sentinel 'open from 127.0.0.1.' for process  
*elnode-webserver-proc*<1> <127.0.0.1:59834> with buffer nil
20120814213846: Elnode status: *elnode-webserver-proc*<1> <127.0.0.1:59834> 
open from 127.0.0.1
20120814213847: elnode--sentinel 'open from 127.0.0.1.' for process  
*elnode-webserver-proc*<1> <127.0.0.1:59836> with buffer nil
20120814213847: Elnode status: *elnode-webserver-proc*<1> <127.0.0.1:59836> 
open from 127.0.0.1
20120814213847: filter: calling handler on *elnode-webserver-proc*<1> 
<127.0.0.1:59834>
20120814213848: starting HTTP response on *elnode-webserver-proc*<1> 
<127.0.0.1:59834>
20120814213848: Elnode-child-process init *elnode-webserver-proc*<1> 
<127.0.0.1:59834>
20120814213848: filter: handler returned on *elnode-webserver-proc*<1> 
<127.0.0.1:59834>
20120814213848: Elnode-child-process-filter http state: open data length: 4096 
on *elnode-webserver-proc*<1> <127.0.0.1:59834>
20120814213848: Elnode-child-process-filter http state: open data length: 4096 
on *elnode-webserver-proc*<1> <127.0.0.1:59834>
20120814213848: Elnode-child-process-filter http state: open data length: 1286 
on *elnode-webserver-proc*<1> <127.0.0.1:59834>
20120814213848: Elnode-child-process-sentinel Status @ finished: open -> exit 
on *elnode-webserver-proc*<1> <127.0.0.1:59834>
20120814213848: elnode--http-end ending socket *elnode-webserver-proc*<1> 
<127.0.0.1:59834>
20120814213848: elnode--sentinel 'deleted.' for process  
*elnode-webserver-proc*<1> <127.0.0.1:59834> with buffer  *elnode-request-59834*
20120814213849: Elnode status: *elnode-webserver-proc*<1> <127.0.0.1:59834> 
deleted
20120814213854: filter: calling handler on *elnode-webserver-proc*<1> 
<127.0.0.1:59836>
20120814213854: starting HTTP response on *elnode-webserver-proc*<1> 
<127.0.0.1:59836>
20120814213854: elnode--process-send-eof on *elnode-webserver-proc*<1> 
<127.0.0.1:59836>
20120814213854: elnode--http-end ending socket *elnode-webserver-proc*<1> 
<127.0.0.1:59836>
20120814213855: elnode--sentinel 'deleted.' for process  
*elnode-webserver-proc*<1> <127.0.0.1:59836> with buffer  *elnode-request-59836*
20120814213855: Elnode status: *elnode-webserver-proc*<1> <127.0.0.1:59836> 
deleted
20120814213855: filter: handler returned on *elnode-webserver-proc*<1> 
<127.0.0.1:59836>
20120814213940: elnode--sentinel 'open from 127.0.0.1.' for process  
*elnode-webserver-proc*<1> <127.0.0.1:59848> with buffer nil
20120814213940: Elnode status: *elnode-webserver-proc*<1> <127.0.0.1:59848> 
open from 127.0.0.1
20120814213940: filter: calling handler on *elnode-webserver-proc*<1> 
<127.0.0.1:59848>
20120814213940: starting HTTP response on *elnode-webserver-proc*<1> 
<127.0.0.1:59848>
20120814213940: elnode--process-send-eof on *elnode-webserver-proc*<1> 
<127.0.0.1:59848>
20120814213940: elnode--http-end ending socket *elnode-webserver-proc*<1> 
<127.0.0.1:59848>
20120814213940: elnode--sentinel 'deleted.' for process  
*elnode-webserver-proc*<1> <127.0.0.1:59848> with buffer  *elnode-request-59848*
20120814213940: Elnode status: *elnode-webserver-proc*<1> <127.0.0.1:59848> 
deleted
20120814213941: filter: handler returned on *elnode-webserver-proc*<1> 
<127.0.0.1:59848>
20120814213954: elnode--sentinel 'open from 127.0.0.1.' for process  
*elnode-webserver-proc*<1> <127.0.0.1:59851> with buffer nil
20120814213954: Elnode status: *elnode-webserver-proc*<1> <127.0.0.1:59851> 
open from 127.0.0.1
20120814213955: filter: calling handler on *elnode-webserver-proc*<1> 
<127.0.0.1:59851>
20120814213955: starting HTTP response on *elnode-webserver-proc*<1> 
<127.0.

Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-14 Thread Bastien
Hi Eric,

Eric Schulte  writes:

> With respect to security, elnode has a simple authentication system
> which seems to work well in my local trials.  It has no forms for
> setting passwords online, so users would have to generate a hash of
> their password locally, and then send the hash to someone who would
> manually add it to the elnode authentication database on orgmode.org.
>
> During authentication the hashed password is sent in plain text, so we
> would need to run the elnode server behind an https proxy server.  I
> don't think this would be difficult to implement and is a good idea for
> any system with authentication.

Thanks for those details.

> With respect to integration with the existing Worg, this system should
> work well in concert with the git backend.  Git could still be used for
> offline edits as it is currently.  The org-ehtml server could be
> configured to commit all web edits to git.  A conflict checker would be
> needed, which could be added to the `org-ehtml-before-save-hook'.

I think a page should be locked when a user is editing it through
org-ehtml.el.  This would prevent conflicts from concurrent editing
from the web.

As for conflicts between the .org to be written (from org-ehtml) and 
the .org that might have been pushed trough git, what would be the
behavior?  Discard this edit?  Use org-merge-driver to help resolve
the conflict?  Let the user download the .org he has been editing, 
so that his changes are not lost?

This is still quite unclear to me.  

In any case, we should first try this on a prototype for a while and 
see if this is robust enough.

-- 
 Bastien



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-14 Thread Eric Schulte
Bastien  writes:

> Rasmus  writes:
>
>> That's very cool!  Good job!  This could be useful.  Would this be
>> something that could eventually be used in the Worg?
>
> If there are some good ideas, and if Jason (as the security guy for 
> the server) is okay, why not?

With respect to security, elnode has a simple authentication system
which seems to work well in my local trials.  It has no forms for
setting passwords online, so users would have to generate a hash of
their password locally, and then send the hash to someone who would
manually add it to the elnode authentication database on orgmode.org.

During authentication the hashed password is sent in plain text, so we
would need to run the elnode server behind an https proxy server.  I
don't think this would be difficult to implement and is a good idea for
any system with authentication.

With respect to integration with the existing Worg, this system should
work well in concert with the git backend.  Git could still be used for
offline edits as it is currently.  The org-ehtml server could be
configured to commit all web edits to git.  A conflict checker would be
needed, which could be added to the `org-ehtml-before-save-hook'.

Cheers,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-14 Thread Bastien
Rasmus  writes:

> That's very cool!  Good job!  This could be useful.  Would this be
> something that could eventually be used in the Worg?

If there are some good ideas, and if Jason (as the security guy for 
the server) is okay, why not?

-- 
 Bastien



Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-14 Thread Rasmus

Eric Schulte  writes:

> I've recently put together a web server which runs in Emacs and exports
> local Org-mode files to HTML in such a way that they may be edited from
> within a web browser with the edits saved to local files on disk.  The
> code is available from github.

That's very cool!  Good job!  This could be useful.  Would this be
something that could eventually be used in the Worg?

–Rasmus

-- 
Hooray!




Re: [O] [ANN] Editable HTML export of Org-mode files

2012-08-14 Thread Bastien
Eric Schulte  writes:

> The code is fairly new so there are likely some kinks to be worked out
> (backup your files before editing them with this web-server), but the
> implementation is very simple and should be easy to modify.  See the
> README for information on how to make use of elnode's authentication
> system, or how to have web edits automatically committed to a local
> version control system.
>
> Comments and patches are welcome.

One single comment: that's *great* stuff.

Thanks!

-- 
 Bastien



[O] [ANN] Editable HTML export of Org-mode files

2012-08-13 Thread Eric Schulte
Hi,

I've recently put together a web server which runs in Emacs and exports
local Org-mode files to HTML in such a way that they may be edited from
within a web browser with the edits saved to local files on disk.  The
code is available from github.

 repository  https://github.com/eschulte/org-ehtml
  README --- http://eschulte.github.com/org-ehtml

This is a very thin Emacs Lisp and JavaScript wrapper around Nic
Ferrier's elnode Emacs web server [1], and Nicolas Goaziou's structured
Org-mode file representation and export engine.  It requires Emacs 24
and the development versions of both Org-mode and elnode.

The code is fairly new so there are likely some kinks to be worked out
(backup your files before editing them with this web-server), but the
implementation is very simple and should be easy to modify.  See the
README for information on how to make use of elnode's authentication
system, or how to have web edits automatically committed to a local
version control system.

Comments and patches are welcome.

Cheers,

Footnotes: 
[1]  https://github.com/nicferrier/elnode

-- 
Eric Schulte
http://cs.unm.edu/~eschulte