File tree Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 3
3
# Version of the quarto package
4
4
__version__ = "0.1.0"
5
5
6
+ from quarto .quarto import path
6
7
from quarto .render import render
7
8
from quarto .metadata import metadata
Original file line number Diff line number Diff line change 1
1
2
2
import sys
3
+ import json
4
+ import subprocess
5
+
6
+ from quarto .quarto import find_quarto
3
7
4
8
def metadata (input ):
5
- print ("render" , file = sys .stdout )
9
+ args = ["metadata" , input , "--json" ]
10
+ metadata_json = subprocess .check_output ([find_quarto ()] + args )
11
+ return json .loads (metadata_json )
12
+
13
+
Original file line number Diff line number Diff line change
1
+
2
+ import os
3
+ import sys
4
+ import shutil
5
+ import subprocess
6
+
7
+ def path ():
8
+ path_env = os .getenv ("QUARTO_PATH" )
9
+ if path_env is None :
10
+ return shutil .which ("quarto" )
11
+ else :
12
+ return path_env
13
+
14
+
15
+ def find_quarto ():
16
+ quarto = path ()
17
+ if quarto is None :
18
+ raise FileNotFoundError ('Unable to find quarto command line tools.' )
19
+ return quarto
Original file line number Diff line number Diff line change 1
1
2
2
import sys
3
+ import subprocess
4
+
5
+ from quarto .quarto import find_quarto
3
6
4
7
def render (input ):
5
- print ("render" , file = sys .stdout )
8
+ args = ["render" , input ]
9
+ process = subprocess .Popen ([find_quarto ()] + args )
10
+ process .wait ()
11
+
12
+
You can’t perform that action at this time.
0 commit comments