Org html: make src lang labels lang not mode
This commit is contained in:
parent
f5dc045d9b
commit
19001f137a
89
config.org
89
config.org
|
@ -4651,13 +4651,100 @@ somewhat spiffy.
|
|||
"Wrap the usual <pre> block in a <details>"
|
||||
:around #'org-html-src-block
|
||||
(let* ((properties (cadr src-block))
|
||||
(lang (plist-get properties :language))
|
||||
(lang (mode-name-to-lang-name
|
||||
(plist-get properties :language)))
|
||||
(name (plist-get properties :name)))
|
||||
(format "<details class='code' open><summary%s>%s</summary>%s</details>"
|
||||
(if name " class='named'" "")
|
||||
(if (not name) (concat "<span class='lang'>" lang "</span>")
|
||||
(format "<span class='name'>%s</span><span class='lang'>%s</span>" name lang))
|
||||
(funcall orig-fn src-block contents info))))
|
||||
|
||||
(defun mode-name-to-lang-name (mode)
|
||||
(or (cadr (assoc mode
|
||||
'(("asymptote" "Asymptote")
|
||||
("awk" "Awk")
|
||||
("C" "C")
|
||||
("clojure" "Clojure")
|
||||
("css" "CSS")
|
||||
("D" "D")
|
||||
("ditaa" "ditaa")
|
||||
("dot" "Graphviz")
|
||||
("calc" "Emacs Calc")
|
||||
("emacs-lisp" "Emacs Lisp")
|
||||
("fortran" "Fortran")
|
||||
("gnuplot" "gnuplot")
|
||||
("haskell" "Haskell")
|
||||
("hledger" "hledger")
|
||||
("java" "Java")
|
||||
("js" "Javascript")
|
||||
("latex" "LaTeX")
|
||||
("ledger" "Ledger")
|
||||
("lisp" "Lisp")
|
||||
("lilypond" "Lilypond")
|
||||
("lua" "Lua")
|
||||
("matlab" "MATLAB")
|
||||
("mscgen" "Mscgen")
|
||||
("ocaml" "Objective Caml")
|
||||
("octave" "Octave")
|
||||
("org" "Org mode")
|
||||
("oz" "OZ")
|
||||
("plantuml" "Plantuml")
|
||||
("processing" "Processing.js")
|
||||
("python" "Python")
|
||||
("R" "R")
|
||||
("ruby" "Ruby")
|
||||
("sass" "Sass")
|
||||
("scheme" "Scheme")
|
||||
("screen" "Gnu Screen")
|
||||
("sed" "Sed")
|
||||
("sh" "shell")
|
||||
("sql" "SQL")
|
||||
("sqlite" "SQLite")
|
||||
("forth" "Forth")
|
||||
("io" "IO")
|
||||
("J" "J")
|
||||
("makefile" "Makefile")
|
||||
("maxima" "Maxima")
|
||||
("perl" "Perl")
|
||||
("picolisp" "Pico Lisp")
|
||||
("scala" "Scala")
|
||||
("shell" "Shell Script")
|
||||
("ebnf2ps" "ebfn2ps")
|
||||
("cpp" "C++")
|
||||
("abc" "ABC")
|
||||
("coq" "Coq")
|
||||
("groovy" "Groovy")
|
||||
("bash" "bash")
|
||||
("csh" "csh")
|
||||
("ash" "ash")
|
||||
("dash" "dash")
|
||||
("ksh" "ksh")
|
||||
("mksh" "mksh")
|
||||
("posh" "posh")
|
||||
("ada" "Ada")
|
||||
("asm" "Assembler")
|
||||
("caml" "Caml")
|
||||
("delphi" "Delphi")
|
||||
("html" "HTML")
|
||||
("idl" "IDL")
|
||||
("mercury" "Mercury")
|
||||
("metapost" "MetaPost")
|
||||
("modula-2" "Modula-2")
|
||||
("pascal" "Pascal")
|
||||
("ps" "PostScript")
|
||||
("prolog" "Prolog")
|
||||
("simula" "Simula")
|
||||
("tcl" "tcl")
|
||||
("tex" "LaTeX")
|
||||
("plain-tex" "TeX")
|
||||
("verilog" "Verilog")
|
||||
("vhdl" "VHDL")
|
||||
("xml" "XML")
|
||||
("nxml" "XML")
|
||||
("conf" "Configuration File")
|
||||
)))
|
||||
mode))
|
||||
#+END_SRC
|
||||
|
||||
#+NAME: Exampl, fixed width, and property blocks
|
||||
|
|
|
@ -82,6 +82,10 @@ details.code {
|
|||
color: $text-medium;
|
||||
margin-right: 0.7em;
|
||||
}
|
||||
.lang {
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
summary::marker {
|
||||
color: $back-medium;
|
||||
|
|
|
@ -14,6 +14,8 @@ body {
|
|||
#page {
|
||||
color: $text-dark;
|
||||
background-color: $back-light;
|
||||
transition-property: color background-color;
|
||||
transition-duration: 200ms;
|
||||
}
|
||||
|
||||
#content, header, .page-header {
|
||||
|
|
|
@ -491,7 +491,9 @@ body {
|
|||
|
||||
#page {
|
||||
color: var(--text-dark);
|
||||
background-color: var(--back-light); }
|
||||
background-color: var(--back-light);
|
||||
transition-property: color background-color;
|
||||
transition-duration: 200ms; }
|
||||
|
||||
#content, header, .page-header {
|
||||
margin: 32px;
|
||||
|
@ -1157,6 +1159,9 @@ details.code summary {
|
|||
font-size: 14px;
|
||||
color: var(--text-medium);
|
||||
margin-right: 0.7em; }
|
||||
details.code summary .lang {
|
||||
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
font-style: italic; }
|
||||
|
||||
details.code summary::marker {
|
||||
color: var(--back-medium); }
|
||||
|
|
Loading…
Reference in New Issue