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 `(("html-text" . ,html-text) ("org-text" . ,org-text) ("begin" . ,(number-to-string (plist-get (cadr element) :begin))) ("end" . ,(number-to-string (plist-get (cadr element) :end))))) html-text))))) (eval `(org-export-define-derived-backend ehtml e-html :translate-alist ((paragraph . ,(def-ehtml-wrap org-e-html-paragraph)) (plain-list . ,(def-ehtml-wrap org-e-html-plain-list)) (table . ,(def-ehtml-wrap org-e-html-table)) (verbatim . ,(def-ehtml-wrap org-e-html-verbatim)) (quote-block . ,(def-ehtml-wrap org-e-html-quote-block)) ;; (src-block . ,(def-ehtml-wrap org-e-html-src-block)) (verse-block . ,(def-ehtml-wrap org-e-html-verse-block))))) (defun org-ehtml-client-export-to-html (&optional subtreep visible-only body-only ext-plist pub-dir) "Export current buffer to an editable HTML file." (interactive) (let* ((extension (concat "." org-e-html-extension)) (file (org-export-output-file-name extension subtreep pub-dir)) (org-export-coding-system org-e-html-coding-system) ;; custom headers (org-e-html-style-extra (concat org-e-html-style-extra "\n" org-ehtml-client-style)) (org-e-html-scripts (concat org-e-html-scripts "\n" (org-ehtml-client-scripts)))) (org-export-to-file 'ehtml file subtreep visible-only body-only ext-plist))) (defun org-ehtml-client-export-file (file) "Export FILE's contents to editable HTML." (save-window-excursion (find-file file) (org-ehtml-client-export-to-html))) (defun org-ehtml-client-cached (file) "Export FILE to editable HTML if no previous export exists. If a previous HTML export of FILE exists but is older than FILE re-export." (flet ((age (f) (float-time (time-subtract (current-time) (nth 5 (or (file-attributes (file-truename f)) (file-attributes f))))))) (let* ((base (file-name-sans-extension file)) (html (concat base ".html")) (org (concat base ".org"))) (if (and (file-exists-p org) (or (not (file-exists-p html)) (> (age html) (age org)))) (org-ehtml-client-export-file org) html)))) (provide 'org-ehtml-client) this provides the org-ehtml-client where the client can make the changes to the org-file viewed as an editable web page and editable function (defun org-ehtml-client-editable-p (element info). If anyone comes with some solution to make the org-file exported as an editable web page where one can edit the parent headings and subheadings of the content , kindly reply back. Thanks Nitin Agarwal On Mon, Oct 29, 2012 at 1:29 PM, Nitin Agarwal <nitinagarwal3...@gmail.com>wrote: > 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 <simon.t...@gmx.de> 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 <nitinagarwal1...@gmail.com> > *nitin.agar...@students.iiit.ac.in* > -- *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 <nitinagarwal1...@gmail.com> *nitin.agar...@students.iiit.ac.in*