summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-03-12 07:41:38 +0100
committerBastien Guerry <bzg@altern.org>2013-03-12 07:41:38 +0100
commitbaa299952fd840adf33d6a3809e12b2a4c9505a2 (patch)
tree57a3d5fc783f9f2bbf65aad6b80bf5cccd755b63
parentabc94ec96ab4d17342ee2527e6757447e49cf1b2 (diff)
downloadorg-mode-baa299952fd840adf33d6a3809e12b2a4c9505a2.tar.gz
ox-html.el: New CSS .underline and #org-div-home-and-up.
* ox-html.el (org-html-style-default): New CSS .underline and #org-div-home-and-up. (org-html-text-markup-alist): Don't hardcode the style, use the new class .underline. (org-html-home/up-format): Don't hardcode the style, use #org-div-home-and-up. (org-html-center-block): Use the .center class.
-rw-r--r--lisp/ox-html.el105
1 files changed, 18 insertions, 87 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index c55be12..945ddd4 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -38,7 +38,6 @@
(require 'format-spec)
(eval-when-compile (require 'cl) (require 'table))
-
;;; Function Declarations
@@ -47,7 +46,6 @@
(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
-
;;; Define Back-End
(org-export-define-backend html
@@ -129,7 +127,6 @@
;; Leave room for "ox-infojs.el" extension.
(:infojs-opt "INFOJS_OPT" nil nil)))
-
;;; Internal Variables
@@ -205,6 +202,7 @@ for the JavaScript code in this tag.
.right { margin-left: auto; margin-right: 0px; text-align: right; }
.left { margin-left: 0px; margin-right: auto; text-align: left; }
.center { margin-left: auto; margin-right: auto; text-align: center; }
+ .underline { text-decoration: underline; }
#content { margin: 3em; }
#postamble p, a { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
@@ -241,21 +239,23 @@ for the JavaScript code in this tag.
table { border-collapse:collapse; }
td, th { vertical-align:top; }
- th.right { text-align:center; }
- th.left { text-align:center; }
- th.center { text-align:center; }
- td.right { text-align:right; }
- td.left { text-align:left; }
- td.center { text-align:center; }
+ th.right { text-align: center; }
+ th.left { text-align: center; }
+ th.center { text-align: center; }
+ td.right { text-align: right; }
+ td.left { text-align: left; }
+ td.center { text-align: center; }
dt { font-weight: bold; }
- div.figure { padding:1em; }
- div.figure p { text-align:center; }
- div.inlinetask {
- padding:10px;
- border:2px solid gray;
- margin:10px;
+ .figure { padding: 1em; }
+ .figure p { text-align: center; }
+ .inlinetask {
+ padding: 10px;
+ border: 2px solid gray;
+ margin: 10px;
background: #ffffcc;
}
+ #org-div-home-and-up
+ { text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x:auto; }
.linenr { font-size:smaller }
.code-highlighted { background-color:#ffff00; }
@@ -271,7 +271,6 @@ You can use `org-html-head' and `org-html-head-extra' to add to
this style. If you don't want to include this default style,
customize `org-html-head-include-default-style'.")
-
;;; User Configuration Variables
@@ -280,7 +279,6 @@ customize `org-html-head-include-default-style'.")
:tag "Org Export HTML"
:group 'org-export)
-
;;;; Handle infojs
(defvar org-html-infojs-opts-table
@@ -486,7 +484,6 @@ export back-end currently used."
;; Return the modified property list.
exp-plist)))
-
;;;; Bold, etc.
(defcustom org-html-text-markup-alist
@@ -494,7 +491,7 @@ export back-end currently used."
(code . "<code>%s</code>")
(italic . "<i>%s</i>")
(strike-through . "<del>%s</del>")
- (underline . "<span style=\"text-decoration:underline;\">%s</span>")
+ (underline . "<span class=\"underline\">%s</span>")
(verbatim . "<code>%s</code>"))
"Alist of HTML expressions to convert text markup.
@@ -536,7 +533,6 @@ in order to mimic default behaviour:
:group 'org-export-html
:type 'function)
-
;;;; Footnotes
(defcustom org-html-footnotes-section "<div id=\"footnotes\">
@@ -563,7 +559,6 @@ by the footnotes themselves."
:group 'org-export-html
:type 'string)
-
;;;; Headline
(defcustom org-html-toplevel-hlevel 2
@@ -591,7 +586,6 @@ The function result will be used in the section format string."
:group 'org-export-html
:type 'function)
-
;;;; HTML-specific
(defcustom org-html-allow-name-attribute-in-anchors t
@@ -603,7 +597,6 @@ attributes, when appropriate."
:package-version '(Org . "8.0")
:type 'boolean)
-
;;;; Inlinetasks
(defcustom org-html-format-inlinetask-function nil
@@ -621,7 +614,6 @@ The function should return the string to be exported."
:group 'org-export-html
:type 'function)
-
;;;; LaTeX
(defcustom org-html-with-latex org-export-with-latex
@@ -652,7 +644,6 @@ t Synonym for `mathjax'."
(const :tag "Use MathJax to display math" mathjax)
(const :tag "Leave math verbatim" verbatim)))
-
;;;; Links :: Generic
(defcustom org-html-link-org-files-as-html t
@@ -667,7 +658,6 @@ When nil, the links still point to the plain `.org' file."
:group 'org-export-html
:type 'boolean)
-
;;;; Links :: Inline images
(defcustom org-html-inline-images 'maybe
@@ -702,7 +692,6 @@ default we use here encompasses both."
:type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
-
;;;; Plain Text
(defcustom org-html-protect-char-alist
@@ -714,7 +703,6 @@ default we use here encompasses both."
:type '(repeat (cons (string :tag "Character")
(string :tag "HTML equivalent"))))
-
;;;; Src Block
(defcustom org-html-htmlize-output-type 'inline-css
@@ -817,7 +805,6 @@ Otherwise, place it near the end."
:group 'org-export-html
:type 'boolean)
-
;;;; Tags
(defcustom org-html-tag-class-prefix ""
@@ -829,7 +816,6 @@ CSS classes, then this prefix can be very useful."
:group 'org-export-html
:type 'string)
-
;;;; Template :: Generic
(defcustom org-html-extension "html"
@@ -872,7 +858,6 @@ postamble DIV."
(string :tag " Div for the content:")
(string :tag "Div for the postamble:")))
-
;;;; Template :: Mathjax
(defcustom org-html-mathjax-options
@@ -954,7 +939,6 @@ You can also customize this for each buffer, using something like
:group 'org-export-html
:type 'string)
-
;;;; Template :: Postamble
(defcustom org-html-postamble 'auto
@@ -1018,7 +1002,6 @@ like that: \"%%\"."
:group 'org-export-html
:type '(string :tag "Creator string"))
-
;;;; Template :: Preamble
(defcustom org-html-preamble t
@@ -1075,7 +1058,7 @@ example."
:type '(string :tag "File or URL"))
(defcustom org-html-home/up-format
- "<div id=\"org-div-home-and-up\" style=\"text-align:right;font-size:70%%;white-space:nowrap;\">
+ "<div id=\"org-div-home-and-up\">
<a accesskey=\"h\" href=\"%s\"> UP </a>
|
<a accesskey=\"H\" href=\"%s\"> HOME </a>
@@ -1088,7 +1071,6 @@ ignored."
:group 'org-export-html
:type 'string)
-
;;;; Template :: Scripts
(define-obsolete-variable-alias
@@ -1102,7 +1084,6 @@ not be modified."
:package-version '(Org . "8.0")
:type 'boolean)
-
;;;; Template :: Styles
(define-obsolete-variable-alias
@@ -1157,7 +1138,6 @@ or for publication projects using the :html-head property."
;;;###autoload
(put 'org-html-head 'safe-local-variable 'stringp)
-
(defcustom org-html-head-extra ""
"More head information to add in the HTML output.
@@ -1221,7 +1201,6 @@ ELEMENT is either a src block or an example block."
(or (plist-get attr :height) (org-count-lines code))
code)))
-
;;;; Bibliography
(defun org-html-bibliography ()
@@ -1375,7 +1354,6 @@ INFO is a plist used as a communication channel."
"\n%s\n"
(mapconcat 'org-html-format-footnote-definition fn-alist "\n"))))))
-
;;; Template
@@ -1761,7 +1739,6 @@ a plist used as a communication channel."
(new 0))))
(org-html-do-format-code code lang refs retain-labels num-start)))
-
;;; Tables of Contents
@@ -1910,7 +1887,6 @@ of tables as a string, or nil if it is empty."
lol-entries "\n"))
"\n</ul>\n</div>\n</div>"))))
-
;;; Transcode Functions
@@ -1923,15 +1899,13 @@ contextual information."
(format (or (cdr (assq 'bold org-html-text-markup-alist)) "%s")
contents))
-
;;;; Center Block
(defun org-html-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to HTML.
CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
- (format "<div style=\"text-align: center\">\n%s</div>" contents))
-
+ (format "<div class=\"center\">\n%s</div>" contents))
;;;; Clock
@@ -1951,7 +1925,6 @@ channel."
(let ((time (org-element-property :duration clock)))
(and time (format " <span class=\"timestamp\">(%s)</span>" time)))))
-
;;;; Code
(defun org-html-code (code contents info)
@@ -1961,7 +1934,6 @@ information."
(format (or (cdr (assq 'code org-html-text-markup-alist)) "%s")
(org-html-plain-text (org-element-property :value code) info)))
-
;;;; Drawer
(defun org-html-drawer (drawer contents info)
@@ -1976,7 +1948,6 @@ holding contextual information."
;; display contents of the drawer.
contents))
-
;;;; Dynamic Block
(defun org-html-dynamic-block (dynamic-block contents info)
@@ -1985,7 +1956,6 @@ CONTENTS holds the contents of the block. INFO is a plist
holding contextual information. See `org-export-data'."
contents)
-
;;;; Entity
(defun org-html-entity (entity contents info)
@@ -1994,7 +1964,6 @@ CONTENTS are the definition itself. INFO is a plist holding
contextual information."
(org-element-property :html entity))
-
;;;; Example Block
(defun org-html-example-block (example-block contents info)
@@ -2006,7 +1975,6 @@ information."
(format "<pre class=\"example\">\n%s</pre>"
(org-html-format-code example-block info))))
-
;;;; Export Snippet
(defun org-html-export-snippet (export-snippet contents info)
@@ -2016,7 +1984,6 @@ information."
(when (eq (org-export-snippet-backend export-snippet) 'html)
(org-element-property :value export-snippet)))
-
;;;; Export Block
(defun org-html-export-block (export-block contents info)
@@ -2025,7 +1992,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(when (string= (org-element-property :type export-block) "HTML")
(org-remove-indentation (org-element-property :value export-block))))
-
;;;; Fixed Width
(defun org-html-fixed-width (fixed-width contents info)
@@ -2036,7 +2002,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(org-remove-indentation
(org-element-property :value fixed-width)))))
-
;;;; Footnote Reference
(defun org-html-footnote-reference (footnote-reference contents info)
@@ -2062,7 +2027,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(org-export-get-footnote-number footnote-reference info)
"IGNORED" 1)))))
-
;;;; Headline
(defun org-html-format-headline--wrap
@@ -2183,7 +2147,6 @@ holding contextual information."
contents)
contents)))))))
-
;;;; Horizontal Rule
(defun org-html-horizontal-rule (horizontal-rule contents info)
@@ -2191,7 +2154,6 @@ holding contextual information."
CONTENTS is nil. INFO is a plist holding contextual information."
"<hr/>")
-
;;;; Inline Src Block
(defun org-html-inline-src-block (inline-src-block contents info)
@@ -2202,7 +2164,6 @@ contextual information."
(code (org-element-property :value inline-src-block)))
(error "Cannot export inline src block")))
-
;;;; Inlinetask
(defun org-html-format-section (text class &optional id)
@@ -2231,7 +2192,6 @@ holding contextual information."
(org-html-format-headline--wrap inlinetask info)
contents))))
-
;;;; Italic
(defun org-html-italic (italic contents info)
@@ -2240,7 +2200,6 @@ CONTENTS is the text with italic markup. INFO is a plist holding
contextual information."
(format (or (cdr (assq 'italic org-html-text-markup-alist)) "%s") contents))
-
;;;; Item
(defun org-html-checkbox (checkbox)
@@ -2296,7 +2255,6 @@ contextual information."
(org-html-format-list-item
contents type checkbox (or tag counter))))
-
;;;; Keyword
(defun org-html-keyword (keyword contents info)
@@ -2319,7 +2277,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
((string= "listings" value) (org-html-list-of-listings info))
((string= "tables" value) (org-html-list-of-tables info))))))))
-
;;;; Latex Environment
(defun org-html-format-latex (latex-frag processing-type)
@@ -2360,7 +2317,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(match-string 1 formula-link) caption label attr t))))
(t latex-frag))))
-
;;;; Latex Fragment
(defun org-html-latex-fragment (latex-fragment contents info)
@@ -2380,7 +2336,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(match-string 1 formula-link)))))
(t latex-frag))))
-
;;;; Line Break
(defun org-html-line-break (line-break contents info)
@@ -2388,7 +2343,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
CONTENTS is nil. INFO is a plist holding contextual information."
"<br/>\n")
-
;;;; Link
(defun org-html-link--inline-image (link desc info)
@@ -2638,7 +2592,6 @@ INFO is a plist holding contextual information. See
;; No path, only description. Try to do something useful.
(t (format "<i>%s</i>" desc)))))
-
;;;; Paragraph
(defun org-html-paragraph (paragraph contents info)
@@ -2663,7 +2616,6 @@ the plist used as a communication channel."
contents)
(t (format "<p%s>\n%s</p>%s" extra contents after)))))
-
;;;; Plain List
;; FIXME Maybe arg1 is not needed because <li value="20"> already sets
@@ -2770,7 +2722,6 @@ channel."
(org-element-property :raw-value scheduled)))))))
" "))))
-
;;;; Property Drawer
(defun org-html-property-drawer (property-drawer contents info)
@@ -2781,7 +2732,6 @@ information."
;; lines nonetheless.
"")
-
;;;; Quote Block
(defun org-html-quote-block (quote-block contents info)
@@ -2790,7 +2740,6 @@ CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(format "<blockquote>\n%s</blockquote>" contents))
-
;;;; Quote Section
(defun org-html-quote-section (quote-section contents info)
@@ -2800,7 +2749,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(org-element-property :value quote-section))))
(when value (format "<pre>\n%s</pre>" value))))
-
;;;; Section
(defun org-html-section (section contents info)
@@ -2833,7 +2781,6 @@ contextual information."
(org-element-property :value radio-target))))
(org-html--anchor id text)))
-
;;;; Special Block
(defun org-html-special-block (special-block contents info)
@@ -2844,7 +2791,6 @@ holding contextual information."
(downcase (org-element-property :type special-block))
contents))
-
;;;; Src Block
(defun org-html-src-block (src-block contents info)
@@ -2868,7 +2814,6 @@ contextual information."
(org-export-data caption info)))
(format "\n<pre class=\"src src-%s\"%s>%s</pre>" lang label code))))))
-
;;;; Statistics Cookie
(defun org-html-statistics-cookie (statistics-cookie contents info)
@@ -2877,7 +2822,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(let ((cookie-value (org-element-property :value statistics-cookie)))
(format "<code>%s</code>" cookie-value)))
-
;;;; Strike-Through
(defun org-html-strike-through (strike-through contents info)
@@ -2887,7 +2831,6 @@ holding contextual information."
(format (or (cdr (assq 'strike-through org-html-text-markup-alist)) "%s")
contents))
-
;;;; Subscript
(defun org-html-subscript (subscript contents info)
@@ -2896,7 +2839,6 @@ CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
(format "<sub>%s</sub>" contents))
-
;;;; Superscript
(defun org-html-superscript (superscript contents info)
@@ -2905,7 +2847,6 @@ CONTENTS is the contents of the object. INFO is a plist holding
contextual information."
(format "<sup>%s</sup>" contents))
-
;;;; Tabel Cell
(defun org-html-table-cell (table-cell contents info)
@@ -2934,7 +2875,6 @@ channel."
(t (concat "\n" (format (car org-html-table-data-tags) cell-attrs)
contents (cdr org-html-table-data-tags))))))
-
;;;; Table Row
(defun org-html-table-row (table-row contents info)
@@ -2969,7 +2909,6 @@ communication channel."
(when (org-export-table-row-ends-rowgroup-p table-row info)
(cdr rowgroup-tags))))))
-
;;;; Table
(defun org-html-table-first-row-data-cells (table info)
@@ -3057,7 +2996,6 @@ contextual information."
(funcall table-column-specs table info)
contents)))))
-
;;;; Target
(defun org-html-target (target contents info)
@@ -3068,7 +3006,6 @@ information."
(org-element-property :value target))))
(org-html--anchor id)))
-
;;;; Timestamp
(defun org-html-timestamp (timestamp contents info)
@@ -3080,7 +3017,6 @@ information."
(format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
(replace-regexp-in-string "--" "&#x2013;" value))))
-
;;;; Underline
(defun org-html-underline (underline contents info)
@@ -3090,7 +3026,6 @@ holding contextual information."
(format (or (cdr (assq 'underline org-html-text-markup-alist)) "%s")
contents))
-
;;;; Verbatim
(defun org-html-verbatim (verbatim contents info)
@@ -3100,7 +3035,6 @@ information."
(format (or (cdr (assq 'verbatim org-html-text-markup-alist)) "%s")
(org-html-plain-text (org-element-property :value verbatim) info)))
-
;;;; Verse Block
(defun org-html-verse-block (verse-block contents info)
@@ -3122,7 +3056,6 @@ contextual information."
(setq contents (replace-match ws nil t contents))))
(format "<p class=\"verse\">\n%s</p>" contents))
-
;;; Filter Functions
@@ -3136,7 +3069,6 @@ Prettifying happens if `org-html-pretty-output' is t."
(indent-region (point-min) (point-max))
(buffer-substring-no-properties (point-min) (point-max)))))
-
;;; End-user functions
@@ -3245,7 +3177,6 @@ publishing directory.
Return output file name."
(org-publish-org-to 'html filename ".html" plist pub-dir))
-
;;; FIXME