From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [ANN] Editable HTML export of Org-mode files Date: Thu, 16 Aug 2012 00:45:39 -0600 Message-ID: <87d32ribbv.fsf@gmx.com> References: <87pq6ua0kk.fsf@gmx.com> <87mx1wbzun.fsf@ericabrahamsen.net> <87txw4b2w4.fsf@gmx.com> <87sjbn4su4.fsf@gmx.com> <874no3v2yv.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:53037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1tr8-0006CZ-9G for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 02:46:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1tr6-0005mU-UR for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 02:46:58 -0400 Received: from mailout-us.gmx.com ([74.208.5.67]:48313) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1T1tr6-0005mL-Nb for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 02:46:56 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Abrahamsen Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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" > #("\n

foo\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:". --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=batch.el Content-Transfer-Encoding: quoted-printable ;;; batch.el --- Batch Emacs test for org-ehtml ;;; Instructions: ;; ;; 1. Edit the `org-ehtml-load-paths' paths below to point to the ;; related resources on your system. ;;=20=20=20=20 ;; 2. Launch an Emacs process which will load this configuration and ;; only this configuration using the -Q option as follows ;; ;; emacs -Q -l batch.el ;;=20 ;; 3. You will now be serving the example test files on port 3333. ;; Browse to http://localhost:3333/simple.org and try to perform an ;; edit through the web interface. ;; ;; 4. If the edit works then everything is working as expected, if for ;; some reason the edit doesn't work, look through the output in ;; your *Messages* buffer following the "start-relevant-output" ;; line, and see if anything looks suspicious or send this output ;; to the list. ;;; Code: (defvar org-ehtml-load-paths '("path/to/elnode" "path/to/org-mode/lisp" "path/to/org-mode/contrib/lisp" "path/to/org-ehtml/src" "path/to/org-ehtml/test/lisp") "Update these paths to set your load path.") (mapc (lambda (path) (add-to-list 'load-path path)) org-ehtml-load-paths) (require 'test-org-ehtml) (setq debug-on-error t ;; show debug info for any errors org-e-html-postamble nil ;; don't export a postamble elnode-error-log-to-messages nil ;; stifle unhelpful & noisy elnode warnin= gs org-ehtml-docroot test-org-ehtml-example-dir org-ehtml-port 3333) ;; stop the default org-ehtml server (elnode-stop 8000) (elnode-start 'org-ehtml-handler :port org-ehtml-port) ;; redefine `org-ehtml-edit-handler' with more debug output (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)))) (message "params:%S" params) (message "org:%S" org) (org-babel-with-temp-filebuffer (expand-file-name path org-ehtml-docroo= t) (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)))) ;; switch to the *Messages* buffer (switch-to-buffer "*Messages*") (message "---------------------start-relevant-output---------------------") --=-=-= Content-Type: text/plain Thanks, -- Eric Schulte http://cs.unm.edu/~eschulte --=-=-=--