first commit cont.
This commit is contained in:
6
_extensions/jjallaire/code-visibility/_extension.yml
Normal file
6
_extensions/jjallaire/code-visibility/_extension.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
title: Code Visibility
|
||||
author: fast.ai
|
||||
version: 1.0.0
|
||||
contributes:
|
||||
filters:
|
||||
- code-visibility.lua
|
||||
51
_extensions/jjallaire/code-visibility/code-visibility.lua
Normal file
51
_extensions/jjallaire/code-visibility/code-visibility.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
|
||||
-- remove any lines with the hide_line directive.
|
||||
function CodeBlock(el)
|
||||
if el.classes:includes('cell-code') then
|
||||
el.text = filter_lines(el.text, function(line)
|
||||
return not line:match("#| ?hide_line%s*$")
|
||||
end)
|
||||
return el
|
||||
end
|
||||
end
|
||||
|
||||
-- apply filter_stream directive to cells
|
||||
function Div(el)
|
||||
if el.classes:includes("cell") then
|
||||
local filters = el.attributes["filter_stream"]
|
||||
if filters then
|
||||
-- process cell-code
|
||||
return pandoc.walk_block(el, {
|
||||
CodeBlock = function(el)
|
||||
-- CodeBlock that isn't `cell-code` is output
|
||||
if not el.classes:includes("cell-code") then
|
||||
for filter in filters:gmatch("[^%s,]+") do
|
||||
el.text = filter_lines(el.text, function(line)
|
||||
return not line:find(filter, 1, true)
|
||||
end)
|
||||
end
|
||||
return el
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function filter_lines(text, filter)
|
||||
local lines = pandoc.List()
|
||||
local code = text .. "\n"
|
||||
for line in code:gmatch("([^\r\n]*)[\r\n]") do
|
||||
if filter(line) then
|
||||
lines:insert(line)
|
||||
end
|
||||
end
|
||||
return table.concat(lines, "\n")
|
||||
end
|
||||
|
||||
|
||||
15
_extensions/julia/_extension.yml
Normal file
15
_extensions/julia/_extension.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
title: Extensions for Julia
|
||||
author: Meik Hellmund
|
||||
version: 0.3.0
|
||||
contributes:
|
||||
format:
|
||||
common:
|
||||
filters:
|
||||
- ansi2htmltex.lua
|
||||
ipynb-filters:
|
||||
- escfilter.py
|
||||
pdf:
|
||||
default
|
||||
|
||||
html:
|
||||
monofont: "JuliaMono"
|
||||
390
_extensions/julia/ansi2htmltex.lua
Normal file
390
_extensions/julia/ansi2htmltex.lua
Normal file
@@ -0,0 +1,390 @@
|
||||
-- this is essentially
|
||||
-- https://github.com/jupyter/nbconvert/blob/main/nbconvert/filters/ansi.py
|
||||
-- converted to lua
|
||||
|
||||
-- good list of ANSI escape sequences:
|
||||
-- https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
|
||||
|
||||
|
||||
local ANSI_COLORS = {
|
||||
"ansi-black",
|
||||
"ansi-red",
|
||||
"ansi-green",
|
||||
"ansi-yellow",
|
||||
"ansi-blue",
|
||||
"ansi-magenta",
|
||||
"ansi-cyan",
|
||||
"ansi-white",
|
||||
"ansi-black-intense",
|
||||
"ansi-red-intense",
|
||||
"ansi-green-intense",
|
||||
"ansi-yellow-intense",
|
||||
"ansi-blue-intense",
|
||||
"ansi-magenta-intense",
|
||||
"ansi-cyan-intense",
|
||||
"ansi-white-intense"
|
||||
}
|
||||
|
||||
local function get_extended_color(numbers)
|
||||
local n = table.remove(numbers, 1)
|
||||
local r,g,b,idx
|
||||
if n == 2 and #numbers >=3 then
|
||||
-- 24bit RGB
|
||||
r = table.remove(numbers, 1)
|
||||
g = table.remove(numbers, 1)
|
||||
b = table.remove(numbers, 1)
|
||||
elseif n == 5 and #numbers >= 1 then
|
||||
-- 256 colors
|
||||
idx = table.remove(numbers, 1)
|
||||
if idx < 16 then
|
||||
-- 16 default terminal colors
|
||||
return idx
|
||||
elseif idx < 232 then
|
||||
-- 6x6x6 color cube, see http://stackoverflow.com/a/27165165/500098
|
||||
r = (idx - 16) // 36
|
||||
r = 55 + r * 40
|
||||
if r < 0 then r = 0 end
|
||||
g = ((idx - 16) % 36) // 6
|
||||
g = 55 + g * 40
|
||||
if g < 0 then g = 0 end
|
||||
b = (idx - 16) % 6
|
||||
b = 55 + b * 40
|
||||
if b < 0 then b = 0 end
|
||||
elseif idx < 256 then
|
||||
-- grayscale, see http://stackoverflow.com/a/27165165/500098
|
||||
r = (idx - 232) * 10 + 8
|
||||
g = r
|
||||
b = r
|
||||
end
|
||||
end
|
||||
return {r, g, b}
|
||||
end
|
||||
|
||||
|
||||
--[=[
|
||||
local re = require "re"
|
||||
|
||||
local ANSI = re.compile [[
|
||||
'\x1b%[' {.*?} {[@-~]}
|
||||
]]
|
||||
|
||||
--]=]
|
||||
|
||||
local function LaTeXconverter(fg, bg, bold, underline, inverse)
|
||||
if not (fg or bg or bold or underline or inverse) then
|
||||
return "",""
|
||||
end
|
||||
|
||||
local starttag = ""
|
||||
local endtag = ""
|
||||
|
||||
if inverse then
|
||||
fg, bg = bg, fg
|
||||
end
|
||||
|
||||
if type(fg) == "number" then
|
||||
starttag = starttag .. [[\textcolor{]] .. ANSI_COLORS[fg+1] .. "}{"
|
||||
endtag = "}" .. endtag
|
||||
elseif type(fg) == "table" then
|
||||
-- See http://tex.stackexchange.com/a/291102/13684
|
||||
starttag = starttag .. [[\def\tcRGB{\textcolor[RGB]}\expandafter]]
|
||||
starttag = starttag .. string.format([[\tcRGB\expandafter{\detokenize{%d,%d,%d}}{]], fg[1], fg[2], fg[3])
|
||||
endtag = "}" .. endtag
|
||||
elseif inverse then
|
||||
starttag = starttag .. [[\textcolor{ansi-default-inverse-fg}{]]
|
||||
endtag = "}" .. endtag
|
||||
end
|
||||
|
||||
if type(bg) == "number" then
|
||||
starttag = starttag .. [[\setlength{\fboxsep}{0pt}]]
|
||||
starttag = starttag .. [[\colorbox{]] .. ANSI_COLORS[bg+1] .. "}{"
|
||||
endtag = [[\strut}]] .. endtag
|
||||
elseif type(bg) == "table" then
|
||||
-- See http://tex.stackexchange.com/a/291102/13684
|
||||
starttag = starttag .. [[\setlength{\fboxsep}{0pt}]]
|
||||
starttag = starttag .. [[\def\cbRGB{\colorbox[RGB]}\expandafter]]
|
||||
starttag = starttag .. string.format([[\cbRGB\expandafter{\detokenize{%d,%d,%d}}{]], bg[1], bg[2], bg[3])
|
||||
endtag = [[\strut}]] .. endtag
|
||||
elseif inverse then
|
||||
starttag = starttag .. [[\setlength{\fboxsep}{0pt}]]
|
||||
starttag = starttag .. [[\colorbox{ansi-default-inverse-bg}{]]
|
||||
endtag = [[\strut}]] .. endtag
|
||||
end
|
||||
|
||||
if bold then
|
||||
starttag = starttag .. [[\textbf{]]
|
||||
endtag = "}" .. endtag
|
||||
end
|
||||
|
||||
if underline then
|
||||
starttag = starttag .. [[\underline{]]
|
||||
endtag = "}" .. endtag
|
||||
end
|
||||
return starttag, endtag
|
||||
end
|
||||
|
||||
local function HTMLconverter(fg, bg, bold, underline, inverse)
|
||||
if not (fg or bg or bold or underline or inverse) then
|
||||
return "",""
|
||||
end
|
||||
local classes = {}
|
||||
local styles = {}
|
||||
local type = type -- more efficient?
|
||||
local next = next
|
||||
if inverse then
|
||||
fg, bg = bg, fg
|
||||
end
|
||||
|
||||
if type(fg) == "number" then
|
||||
table.insert(classes, ANSI_COLORS[fg+1] .. "-fg")
|
||||
elseif type(fg) == "table" then
|
||||
table.insert(styles, string.format("color: rgb(%d,%d,%d)", fg[1], fg[2], fg[3]))
|
||||
elseif inverse then
|
||||
table.insert(classes, "ansi-default-inverse-fg")
|
||||
end
|
||||
|
||||
if type(bg) == "number" then
|
||||
table.insert(classes, ANSI_COLORS[bg+1] .. "-bg")
|
||||
elseif type(bg) == "table" then
|
||||
table.insert(styles, string.format("background-color: rgb(%d,%d,%d)",
|
||||
bg[1], bg[2], bg[3]))
|
||||
elseif inverse then
|
||||
table.insert(classes, "ansi-default-inverse-bg")
|
||||
end
|
||||
|
||||
if bold then
|
||||
table.insert(classes, "ansi-bold")
|
||||
end
|
||||
|
||||
if underline then
|
||||
table.insert(classes, "ansi-underline")
|
||||
end
|
||||
|
||||
local starttag = "<span"
|
||||
if next(classes) ~= nil then
|
||||
starttag = starttag .. ' class="' .. table.concat(classes, " ") .. '"'
|
||||
end
|
||||
|
||||
if next(styles) ~= nil then
|
||||
starttag = starttag .. ' style="' .. table.concat(styles, " ") .. '"'
|
||||
end
|
||||
|
||||
return starttag..">","</span>"
|
||||
end
|
||||
|
||||
|
||||
local function codeBlockTrans(e)
|
||||
local converter, fmt
|
||||
if quarto.doc.isFormat('latex') then
|
||||
converter = LaTeXconverter
|
||||
fmt = 'latex'
|
||||
elseif quarto.doc.isFormat('html') then
|
||||
converter = HTMLconverter
|
||||
fmt = 'html'
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
-- not for input cells
|
||||
if e.classes:includes("julia") or e.classes:includes("cell-code") then
|
||||
return
|
||||
end
|
||||
|
||||
if #e.classes > 0 and not e.classes:includes("julia-stderr") then
|
||||
return
|
||||
end
|
||||
|
||||
local texenv="OutputCell"
|
||||
local codeclass=""
|
||||
if string.find(e.text, "\u{a35f}\u{2983}") then
|
||||
texenv = "AnsiOutputCell"
|
||||
codeclass = "ansi"
|
||||
end
|
||||
if e.classes:includes("julia-stderr") then
|
||||
texenv = "StderrOutputCell"
|
||||
codeclass = codeclass .. " julia-stderr" -- empty leading space doesn't matter
|
||||
end
|
||||
|
||||
local out=""
|
||||
-- if string.find(e.text, "\x1b%[") then
|
||||
if string.find(e.text, "\u{a35f}\u{2983}") then
|
||||
local bold = false
|
||||
local underline = false
|
||||
local inverse = false
|
||||
local text = e.text
|
||||
local chunk = ""
|
||||
local fg = nil
|
||||
local bg = nil
|
||||
local starttag = ""
|
||||
local endtag = ""
|
||||
local numbers={}
|
||||
|
||||
while text ~= "" do
|
||||
numbers = {}
|
||||
-- local s1, e1, c1, d1 = string.find(text, "\x1b%[(.-)([@-~])")
|
||||
local s1, e1, c1, d1 = string.find(text, "\u{a35f}\u{2983}(.-)([@-~])")
|
||||
if s1 then
|
||||
if d1 == "m" then
|
||||
for i in string.gmatch(c1, "([^;]*)") do
|
||||
table.insert(numbers, tonumber(i))
|
||||
end
|
||||
else
|
||||
quarto.log.warning("Unsupported ANSI sequence ESC["..c1..d1.." ignored\n" )
|
||||
end
|
||||
chunk, text = text:sub(1, s1-1), text:sub(e1+1)
|
||||
else
|
||||
chunk, text = text, ""
|
||||
end
|
||||
|
||||
if chunk ~= "" then
|
||||
if bold and type(fg)=="number" and fg<8 then
|
||||
starttag, endtag = converter(fg+8, bg, bold, underline, inverse)
|
||||
else
|
||||
starttag, endtag = converter(fg, bg, bold, underline, inverse)
|
||||
end
|
||||
out = out .. starttag .. chunk .. endtag
|
||||
end
|
||||
|
||||
while next(numbers) ~= nil do
|
||||
local n = table.remove(numbers, 1)
|
||||
if n == 0 then
|
||||
fg = nil
|
||||
bg = nil
|
||||
bold = false
|
||||
inverse = false
|
||||
underline = false
|
||||
elseif n == 1 then
|
||||
bold = true
|
||||
elseif n == 4 then
|
||||
underline = true
|
||||
elseif n == 5 then
|
||||
bold = true -- 'blinking'
|
||||
elseif n == 7 then
|
||||
inverse = true
|
||||
elseif n == 21 or n == 22 then
|
||||
bold = false
|
||||
elseif n == 24 then
|
||||
underline = false
|
||||
elseif n == 27 then
|
||||
inverse = false
|
||||
elseif n >= 30 and n <= 37 then
|
||||
fg = n - 30
|
||||
elseif n == 38 then
|
||||
fg = get_extended_color(numbers)
|
||||
elseif n == 39 then
|
||||
fg = nil
|
||||
elseif n >= 40 and n <= 47 then
|
||||
bg = n - 40
|
||||
elseif n == 48 then
|
||||
bg = get_extended_color(numbers)
|
||||
elseif n == 49 then
|
||||
bg = nil
|
||||
elseif n >= 90 and n <= 97 then
|
||||
fg = n + 8 - 90
|
||||
elseif n >= 100 and n <= 107 then
|
||||
bg = n + 8 - 100
|
||||
else
|
||||
quarto.log.warning(string.format("ESC sequence with unknown code %d before:\n",n))
|
||||
quarto.log.warning(chunk.."\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
out = e.text
|
||||
end
|
||||
if fmt == 'html' then
|
||||
return pandoc.RawBlock(fmt,
|
||||
'<pre class="' .. codeclass ..'"><code class="' .. codeclass .. ' ansi">'..out..'</code></pre>')
|
||||
end
|
||||
if fmt == 'latex' then
|
||||
return pandoc.RawBlock(fmt, [[\begin{]]..texenv.."}\n"..out.."\n"..[[\end{]].. texenv .. "}")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- if div has class 'cell-output-stderr', give CodeBlocks in this div the class 'julia-stderr'
|
||||
local function divStderr(e)
|
||||
if e.classes:includes("cell-output-stderr") then
|
||||
local c = e.content
|
||||
for i,el in pairs(c) do
|
||||
if el.t == 'CodeBlock' then
|
||||
el.classes:insert("julia-stderr")
|
||||
end
|
||||
end
|
||||
return e
|
||||
end
|
||||
end
|
||||
|
||||
-- repair julia ? output
|
||||
local function divCodeBlockNoHeader1(e)
|
||||
if not e.classes:includes("cell-output") then
|
||||
return
|
||||
end
|
||||
local c = e.content
|
||||
for i, el in pairs(c) do
|
||||
if el.t == 'Header' then
|
||||
el.level = 6
|
||||
-- elneu = pandoc.Para(el.content)
|
||||
-- c[i] = elneu
|
||||
end
|
||||
if el.t == 'CodeBlock' then
|
||||
if el.classes:includes("jldoctest") then
|
||||
x,i = el.classes:find("jldoctest")
|
||||
el.classes:remove(i)
|
||||
end
|
||||
end
|
||||
end
|
||||
return e
|
||||
end
|
||||
|
||||
-- test if two divs should be merged
|
||||
local function testmerge(d1, d2)
|
||||
return d1 and d1.t == "Div" and d1.classes:includes("cell-output") and #d1.content == 1
|
||||
and d2 and d2.t == "Div" and d2.classes:includes("cell-output") and #d2.content == 1
|
||||
and d1.content[1].t == "CodeBlock" and not d1.classes:includes("cell-output-stderr")
|
||||
and d2.content[1].t == "CodeBlock" and not d2.classes:includes("cell-output-stderr")
|
||||
end
|
||||
|
||||
-- merge (div (codecell (text1)), div (codecell(text2))) to div(codecell(text1+text2))
|
||||
local function blockMerge(es)
|
||||
local nl = ""
|
||||
for i = #es-1, 1, -1 do
|
||||
if testmerge(es[i], es[i+1]) then
|
||||
str1 = es[i].content[1].text
|
||||
str2 = es[i+1].content[1].text
|
||||
nl = "\n"
|
||||
if es[i].classes:includes("cell-output-stdout") and es[i+1].classes:includes("cell-output-stdout") then
|
||||
if str1:sub(-1) == "\n" then
|
||||
nl = ""
|
||||
end
|
||||
if str2:sub(1, 1) == "\n" then
|
||||
nl = ""
|
||||
end
|
||||
end
|
||||
es[i].content[1].text = str1 .. nl .. str2
|
||||
es:remove(i+1)
|
||||
end
|
||||
end
|
||||
return es
|
||||
end
|
||||
|
||||
local function metaAdd(meta)
|
||||
--for key, val in pairs(PANDOC_READER_OPTIONS) do
|
||||
-- quarto.log.warning(key, val)
|
||||
--end
|
||||
quarto.doc.addHtmlDependency({name='ansicolors',
|
||||
stylesheets = {'resources/css/ansicolor.css'}})
|
||||
quarto.doc.addHtmlDependency({name='juliamonofont',
|
||||
stylesheets = {'resources/css/juliamono.css'}})
|
||||
if quarto.doc.isFormat('latex') then
|
||||
quarto.doc.include_file("in-header", "resources/juliainc.tex")
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
{Div = divStderr},
|
||||
{Div = divCodeBlockNoHeader1},
|
||||
{Blocks = blockMerge},
|
||||
{CodeBlock = codeBlockTrans},
|
||||
{Meta = metaAdd}
|
||||
}
|
||||
5
_extensions/julia/escfilter.py
Executable file
5
_extensions/julia/escfilter.py
Executable file
@@ -0,0 +1,5 @@
|
||||
import sys
|
||||
f = sys.stdin.read()
|
||||
g = f.replace('\\u001b[','ꍟ⦃')
|
||||
sys.stdout.write(g)
|
||||
|
||||
50
_extensions/julia/resources/css/ansicolor.css
Normal file
50
_extensions/julia/resources/css/ansicolor.css
Normal file
@@ -0,0 +1,50 @@
|
||||
/* CSS added by ANSI escape sequences filter */
|
||||
|
||||
.ansi {
|
||||
/* line-height:1.15; */
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
.ansitight *.ansi {
|
||||
line-height: 1.05;
|
||||
}
|
||||
|
||||
.julia-stderr { background-color: #f8d6da; }
|
||||
|
||||
/* console foregrounds and backgrounds */
|
||||
pre .ansi-black-fg { color: #3e424d; }
|
||||
pre .ansi-red-fg { color: #e75c58; }
|
||||
pre .ansi-green-fg { color: #00a250; }
|
||||
pre .ansi-yellow-fg { color: #ddb62b; }
|
||||
pre .ansi-blue-fg { color: #208ffb; }
|
||||
pre .ansi-magenta-fg { color: #d160c4; }
|
||||
pre .ansi-cyan-fg { color: #60c6c8; }
|
||||
pre .ansi-white-fg { color: #c5c1b4; }
|
||||
pre .ansi-black-bg { background-color: #3e424d; }
|
||||
pre .ansi-red-bg { background-color: #e75c58; }
|
||||
pre .ansi-green-bg { background-color: #00a250; }
|
||||
pre .ansi-yellow-bg { background-color: #ddb62b; }
|
||||
pre .ansi-blue-bg { background-color: #208ffb; }
|
||||
pre .ansi-magenta-bg { background-color: #d160c4; }
|
||||
pre .ansi-cyan-bg { background-color: #60c6c8; }
|
||||
pre .ansi-white-bg { background-color: #c5c1b4; }
|
||||
pre .ansi-black-intense-fg { color: #282c36; }
|
||||
pre .ansi-red-intense-fg { color: #b22b31; }
|
||||
pre .ansi-green-intense-fg { color: #007427; }
|
||||
pre .ansi-yellow-intense-fg { color: #b27d12; }
|
||||
pre .ansi-blue-intense-fg { color: #0065ca; }
|
||||
pre .ansi-magenta-intense-fg { color: #a03196; }
|
||||
pre .ansi-cyan-intense-fg { color: #258f8f; }
|
||||
pre .ansi-white-intense-fg { color: #a1a6b2; }
|
||||
pre .ansi-black-intense-bg { background-color: #282c36; }
|
||||
pre .ansi-red-intense-bg { background-color: #b22b31; }
|
||||
pre .ansi-green-intense-bg { background-color: #007427; }
|
||||
pre .ansi-yellow-intense-bg { background-color: #b27d12; }
|
||||
pre .ansi-blue-intense-bg { background-color: #0065ca; }
|
||||
pre .ansi-magenta-intense-bg { background-color: #a03196; }
|
||||
pre .ansi-cyan-intense-bg { background-color: #258f8f; }
|
||||
pre .ansi-white-intense-bg { background-color: #a1a6b2; }
|
||||
pre .ansi-default-inverse-fg { color: rgba(255, 255, 255, 1); }
|
||||
pre .ansi-default-inverse-bg { background-color: #111111; }
|
||||
pre .ansi-bold { font-weight: bold; }
|
||||
pre .ansi-underline { text-decoration: underline; }
|
||||
55
_extensions/julia/resources/css/juliamono.css
Normal file
55
_extensions/julia/resources/css/juliamono.css
Normal file
@@ -0,0 +1,55 @@
|
||||
@font-face {
|
||||
font-family: JuliaMono;
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
src: url("../fonts/JuliaMono-Light.woff2") format("woff2");
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: JuliaMono;
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
src: url("../fonts/JuliaMono-Regular.woff2") format("woff2");
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: JuliaMono;
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
src: url("../fonts/JuliaMono-Medium.woff2") format("woff2");
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: JuliaMono;
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
src: url("../fonts/JuliaMono-SemiBold.woff2") format("woff2");
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: JuliaMono;
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
src: url("../fonts/JuliaMono-Bold.woff2") format("woff2");
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: JuliaMono;
|
||||
font-weight: 800;
|
||||
font-style: normal;
|
||||
src: url("../fonts/JuliaMono-ExtraBold.woff2") format("woff2");
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: JuliaMono;
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
src: url("../fonts/JuliaMono-Black.woff2") format("woff2");
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
BIN
_extensions/julia/resources/fonts/JuliaMono-Black.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-Black.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-BlackItalic.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-BlackItalic.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-Bold.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-Bold.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-BoldItalic.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-BoldLatin.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-BoldLatin.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-ExtraBold.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-ExtraBold.woff2
Normal file
Binary file not shown.
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-Light.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-Light.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-LightItalic.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-LightItalic.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-Medium.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-Medium.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-MediumItalic.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-MediumItalic.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-Regular.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-Regular.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-RegularItalic.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-RegularItalic.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-RegularLatin.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-RegularLatin.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-SemiBold.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-SemiBold.woff2
Normal file
Binary file not shown.
BIN
_extensions/julia/resources/fonts/JuliaMono-SemiBoldItalic.woff2
Normal file
BIN
_extensions/julia/resources/fonts/JuliaMono-SemiBoldItalic.woff2
Normal file
Binary file not shown.
93
_extensions/julia/resources/fonts/LICENSE
Normal file
93
_extensions/julia/resources/fonts/LICENSE
Normal file
@@ -0,0 +1,93 @@
|
||||
Copyright (c) 2020 - 2023, cormullion
|
||||
with Reserved Font Name JuliaMono.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
38
_extensions/julia/resources/juliainc.tex
Normal file
38
_extensions/julia/resources/juliainc.tex
Normal file
@@ -0,0 +1,38 @@
|
||||
\usepackage{fancyvrb}
|
||||
\usepackage{xcolor}
|
||||
\usepackage{fontspec}
|
||||
|
||||
\setmonofont{JuliaMono}[
|
||||
Scale = MatchLowercase,
|
||||
UprightFont = *-Regular,
|
||||
BoldFont = *-Bold,
|
||||
ItalicFont = *-RegularItalic,
|
||||
BoldItalicFont = *-BoldItalic,
|
||||
Contextuals = AlternateOff,
|
||||
]
|
||||
|
||||
\DefineVerbatimEnvironment{OutputCell}{Verbatim}%
|
||||
{xleftmargin=1.5em}
|
||||
\DefineVerbatimEnvironment{AnsiOutputCell}{Verbatim}%
|
||||
{commandchars=\\\{\}, xleftmargin=1.5em}
|
||||
\DefineVerbatimEnvironment{StderrOutputCell}{Verbatim}%
|
||||
{commandchars=\\\{\}, xleftmargin=1.5em,frame=single,rulecolor=\color{red}}
|
||||
|
||||
\definecolor{ansi-black}{HTML}{3E424D}
|
||||
\definecolor{ansi-black-intense}{HTML}{282C36}
|
||||
\definecolor{ansi-red}{HTML}{E75C58}
|
||||
\definecolor{ansi-red-intense}{HTML}{B22B31}
|
||||
\definecolor{ansi-green}{HTML}{00A250}
|
||||
\definecolor{ansi-green-intense}{HTML}{007427}
|
||||
\definecolor{ansi-yellow}{HTML}{DDB62B}
|
||||
\definecolor{ansi-yellow-intense}{HTML}{B27D12}
|
||||
\definecolor{ansi-blue}{HTML}{208FFB}
|
||||
\definecolor{ansi-blue-intense}{HTML}{0065CA}
|
||||
\definecolor{ansi-magenta}{HTML}{D160C4}
|
||||
\definecolor{ansi-magenta-intense}{HTML}{A03196}
|
||||
\definecolor{ansi-cyan}{HTML}{60C6C8}
|
||||
\definecolor{ansi-cyan-intense}{HTML}{258F8F}
|
||||
\definecolor{ansi-white}{HTML}{C5C1B4}
|
||||
\definecolor{ansi-white-intense}{HTML}{A1A6B2}
|
||||
\definecolor{ansi-default-inverse-fg}{HTML}{FFFFFF}
|
||||
\definecolor{ansi-default-inverse-bg}{HTML}{000000}
|
||||
9
_extensions/quarto-ext/latex-environment/_extension.yml
Normal file
9
_extensions/quarto-ext/latex-environment/_extension.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
title: LaTeX Environment
|
||||
author: RStudio, PBC
|
||||
version: 1.1.1
|
||||
quarto-required: ">=1.2.198"
|
||||
contributes:
|
||||
filters:
|
||||
- latex-environment.lua
|
||||
format:
|
||||
pdf: default
|
||||
133
_extensions/quarto-ext/latex-environment/latex-environment.lua
Normal file
133
_extensions/quarto-ext/latex-environment/latex-environment.lua
Normal file
@@ -0,0 +1,133 @@
|
||||
-- environment.lua
|
||||
-- Copyright (C) 2020 by RStudio, PBC
|
||||
|
||||
local classEnvironments = pandoc.MetaMap({})
|
||||
local classCommands = pandoc.MetaMap({})
|
||||
|
||||
-- helper that identifies arrays
|
||||
local function tisarray(t)
|
||||
local i = 0
|
||||
for _ in pairs(t) do
|
||||
i = i + 1
|
||||
if t[i] == nil then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- reads the environments
|
||||
local function readEnvironments(meta)
|
||||
local env = meta['environments']
|
||||
if env ~= nil then
|
||||
if tisarray(env) then
|
||||
-- read an array of strings
|
||||
for i, v in ipairs(env) do
|
||||
local value = pandoc.utils.stringify(v)
|
||||
classEnvironments[value] = value
|
||||
end
|
||||
else
|
||||
-- read key value pairs
|
||||
for k, v in pairs(env) do
|
||||
local key = pandoc.utils.stringify(k)
|
||||
local value = pandoc.utils.stringify(v)
|
||||
classEnvironments[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function readCommands(meta)
|
||||
local env = meta['commands']
|
||||
if env ~= nil then
|
||||
if tisarray(env) then
|
||||
-- read an array of strings
|
||||
for i, v in ipairs(env) do
|
||||
local value = pandoc.utils.stringify(v)
|
||||
classCommands[value] = value
|
||||
end
|
||||
else
|
||||
-- read key value pairs
|
||||
for k, v in pairs(env) do
|
||||
local key = pandoc.utils.stringify(k)
|
||||
local value = pandoc.utils.stringify(v)
|
||||
classCommands[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function readEnvsAndCommands(meta)
|
||||
readEnvironments(meta)
|
||||
readCommands(meta)
|
||||
end
|
||||
|
||||
-- use the environments from metadata to
|
||||
-- emit a custom environment for latex
|
||||
local function writeEnvironments(divEl)
|
||||
if quarto.doc.is_format("latex") then
|
||||
for k, v in pairs(classEnvironments) do
|
||||
if divEl.attr.classes:includes(k) then
|
||||
-- process this into a latex environment
|
||||
local beginEnv = '\\begin' .. '{' .. v .. '}'
|
||||
local endEnv = '\n\\end{' .. v .. '}'
|
||||
|
||||
-- check if custom options or arguments are present
|
||||
-- and add them to the environment accordingly
|
||||
local opts = divEl.attr.attributes['options']
|
||||
if opts then
|
||||
beginEnv = beginEnv .. '[' .. opts .. ']'
|
||||
end
|
||||
|
||||
local args = divEl.attr.attributes['arguments']
|
||||
if args then
|
||||
beginEnv = beginEnv .. '{' .. args .. '}'
|
||||
end
|
||||
|
||||
-- if the first and last div blocks are paragraphs then we can
|
||||
-- bring the environment begin/end closer to the content
|
||||
if #divEl.content > 0 and divEl.content[1].t == "Para" and divEl.content[#divEl.content].t == "Para" then
|
||||
table.insert(divEl.content[1].content, 1, pandoc.RawInline('tex', beginEnv .. "\n"))
|
||||
table.insert(divEl.content[#divEl.content].content, pandoc.RawInline('tex', "\n" .. endEnv))
|
||||
else
|
||||
table.insert(divEl.content, 1, pandoc.RawBlock('tex', beginEnv))
|
||||
table.insert(divEl.content, pandoc.RawBlock('tex', endEnv))
|
||||
end
|
||||
return divEl
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- use the environments from metadata to
|
||||
-- emit a custom environment for latex
|
||||
local function writeCommands(spanEl)
|
||||
if quarto.doc.is_format("latex") then
|
||||
for k, v in pairs(classCommands) do
|
||||
if spanEl.attr.classes:includes(k) then
|
||||
|
||||
-- resolve the begin command
|
||||
local beginCommand = pandoc.RawInline('latex', '\\' .. pandoc.utils.stringify(v) .. '{')
|
||||
local opts = spanEl.attr.attributes['options']
|
||||
if opts then
|
||||
beginCommand = pandoc.RawInline('latex', '\\' .. pandoc.utils.stringify(v) .. '[' .. opts .. ']{')
|
||||
end
|
||||
|
||||
-- the end command
|
||||
local endCommand = pandoc.RawInline('latex', '}')
|
||||
|
||||
-- attach the raw inlines to the span contents
|
||||
local result = spanEl.content
|
||||
table.insert(result, 1, beginCommand)
|
||||
table.insert(result, endCommand)
|
||||
|
||||
return result
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Run in two passes so we process metadata
|
||||
-- and then process the divs
|
||||
return {
|
||||
{ Meta = readEnvsAndCommands },
|
||||
{ Div = writeEnvironments, Span = writeCommands }
|
||||
}
|
||||
Reference in New Issue
Block a user