-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathox-utils-formats.ps1
72 lines (58 loc) · 1.64 KB
/
ox-utils-formats.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
##########################################################
# main
##########################################################
function pdls {
echo 'input-formats`n'
pandoc --list-input-formats
echo 'output-formats`n'
pandoc --list-output-formats
}
if ([string]::IsNullOrEmpty($env:OX_FONT)) {
$env:OX_FONT = "Arial Unicode MS"
}
function font { param ( $the_font ) $env:OX_FONT = $the_font }
##########################################################
# text
##########################################################
function tohtml {
param ( $file )
$name = (basename $file)
pandoc $file -o $name.html --standalone --mathjax --shift-heading-level-by=-1
}
function tomd {
pandoc $file -o $name.md
}
function todocx {
pandoc $file -o $name.docx
}
function totyp {
pandoc $file -o $name.typ
}
##########################################################
# media
##########################################################
function tomp3 {
param ( $file, $bitrate )
$name = (basename $file)
if ([string]::IsNullOrEmpty($cbr)) { $bitrate = "192K" }
else { $cbr = $bitrate + "K" }
ffmpeg -i $file -c:a libmp3lame -b:a $cbr $name.mp3
}
function tomp4 {
param ( $file )
$name = (basename $file)
ffmpeg -fflags +genpts -i $file -r 24 $name .mp4
}
##########################################################
# python
##########################################################
function py2html {
param ( $file )
$name = (basename $file)
marimo export html $name.py > $name.html
}
function ipynb2py {
param ( $file )
$name = (basename $file)
marimo convert $name.ipynb > $name.py
}