Browse Source

updated all iorg-js function names, passing tests

Eric Schulte 8 years ago
parent
commit
fc3c24cbee

+ 1 - 1
iorg/lisp/iorg-html.el

@@ -3,7 +3,7 @@
 (require 'org-export)
 (require 'org-element)
 (require 'org-e-html)
-(require 'util)
+(require 'iorg-util)
 
 ;;;; Define derived backend
 

+ 8 - 8
iorg/lisp/iorg-js.el

@@ -9,7 +9,7 @@
 (defvar iorg-js-style
   (concat
    "<style type=\"text/css\">\n<!--/*--><![CDATA[/*><!--*/\n"
-   (file-contents (expand-file-name "iorg-js.css" iorg-base))
+   (file-contents (expand-file-name "iorg-js.css" iorg-src))
    "/*]]>*/-->\n</style>"))
 
 (defvar iorg-js-jquery
@@ -19,7 +19,7 @@
   (concat
    "<script type=\"text/javascript\" src=\"" iorg-js-jquery "\"></script>"
    "<script type=\"text/javascript\">\n<!--/*--><![CDATA[/*><!--*/\n"
-   (file-contents (expand-file-name "iorg-js.js" iorg-base))
+   (file-contents (expand-file-name "iorg-js.js" iorg-src))
    "/*]]>*///-->\n</script>\n"))
 
 (defvar iorg-js-wrap-template
@@ -54,19 +54,19 @@
 
 (eval `(org-export-define-derived-backend iorg-js e-html
          :translate-alist
-         ((paragraph  . ,(def-iorg-js-wrap html-paragraph))
-          (plain-list . ,(def-iorg-js-wrap html-plain-list)))))
+         ((paragraph  . ,(def-iorg-js-wrap org-e-html-paragraph))
+          (plain-list . ,(def-iorg-js-wrap org-e-html-plain-list)))))
 
 (defun iorg-js-export-to-html
   (&optional subtreep visible-only body-only ext-plist pub-dir)
   "Export current buffer to an interactive HTML file."
   (interactive)
-  (let* ((extension (concat "." html-extension))
+  (let* ((extension (concat "." org-e-html-extension))
 	 (file (org-export-output-file-name extension subtreep pub-dir))
-	 (org-export-coding-system html-coding-system)
+	 (org-export-coding-system org-e-html-coding-system)
          ;; custom headers
-         (html-style-extra iorg-js-style)
-         (html-scripts iorg-js-scripts))
+         (org-e-html-style-extra iorg-js-style)
+         (org-e-html-scripts iorg-js-scripts))
     (org-export-to-file
      'iorg-js file subtreep visible-only body-only ext-plist)))
 

+ 17 - 7
iorg/lisp/iorg-util.el

@@ -21,21 +21,31 @@
              (match-string count in-string)
            assoc)))
 
+(defun non-empty-string-p (str)
+  "Return t if function argument STR is a string of length > 0, nil otherwise."
+ (if (and (stringp str) (> (length str) 0))
+     str
+   nil))
+
 (defmacro while-visiting-file (file &rest body)
   "Execute BODY in a temporary buffer visiting FILE."
   (declare (indent 1))
   `(with-temp-buffer
      (insert-file ,file)
      ,@body))
-
 (def-edebug-spec while-visiting-file (form body))
 
-(defun non-empty-string-p (str)
-  "Return t if function argument STR is a string of length > 0, nil otherwise."
- (if (and (stringp str) (> (length str) 0))
-     str
-   nil))
+(defun file-contents (path)
+  (while-visiting-file path (buffer-string)))
+
+(defvar iorg-base
+  (expand-file-name
+   ".." (file-name-directory (or load-file-name (buffer-file-name)))))
 
+(defvar iorg-lisp
+  (expand-file-name "lisp" iorg-base))
 
+(defvar iorg-src
+  (expand-file-name "src" iorg-base))
 
-(provide 'util)
+(provide 'iorg-util)

+ 1 - 0
iorg/test/examples/.gitignore

@@ -0,0 +1 @@
+**html

+ 0 - 1
iorg/test/lisp/test-iorg-js.el

@@ -2,7 +2,6 @@
 (require 'ert)
 (require 'org-test)
 (require 'iorg-js)
-(require 'iorg-server)
 
 (defvar test-iorg-js-dir
   (file-name-directory (or load-file-name (buffer-file-name))))