Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fred Chasen
vivliostyle-electron
Commits
9cfe48eb
Commit
9cfe48eb
authored
Sep 13, 2016
by
Fred Chasen
Browse files
Fix paths to resolve from process location, update npm instructions
parent
8db4547e
Pipeline
#608
skipped
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
README.md
View file @
9cfe48eb
...
...
@@ -5,7 +5,7 @@ Render Html to PDFs using [Vivliostyle.js](https://github.com/vivliostyle/vivlio
## Installation
```
npm install -g
https://
gitlab.coko.foundation
/
fchasen/vivliostyle-electron.git
npm install -g
git+ssh://git@
gitlab.coko.foundation
:
fchasen/vivliostyle-electron.git
```
## Generating a PDF
...
...
cli.js
View file @
9cfe48eb
...
...
@@ -21,9 +21,10 @@ program
.
parse
(
process
.
argv
);
var
input
=
program
.
inputs
||
program
.
args
[
0
];
var
relativePath
=
path
.
relative
(
__dirname
,
input
);
var
dir
=
process
.
cwd
();
var
relativePath
=
path
.
resolve
(
dir
,
input
);
var
output
=
program
.
output
||
'
./
'
+
path
.
basename
(
input
).
replace
(
'
.xhtml
'
,
'
.pdf
'
).
replace
(
'
.html
'
,
'
.pdf
'
);
var
output
=
program
.
output
?
path
.
resolve
(
dir
,
program
.
output
)
:
'
./
'
+
path
.
basename
(
input
).
replace
(
'
.xhtml
'
,
'
.pdf
'
).
replace
(
'
.html
'
,
'
.pdf
'
);
var
render
;
...
...
@@ -31,6 +32,9 @@ var hyphenate;
var
tmpPath
;
if
(
path
.
extname
(
relativePath
)
!=
(
'
.html
'
||
'
.xhtml
'
))
{
return
console
.
error
(
"
Must pass a html or xhtml file as input
"
);
}
if
(
program
.
hyphenate
)
{
tmpPath
=
relativePath
.
replace
(
"
.xhtml
"
,
"
.hyphenated.xhtml
"
).
replace
(
"
.html
"
,
"
.hyphenated.html
"
);
...
...
@@ -47,7 +51,7 @@ renderer = new Renderer(tmpPath || input, output, {
height
:
program
.
height
,
debug
:
program
.
debug
}).
then
(
function
(
result
)
{
if
(
tmpPath
)
{
if
(
tmpPath
&&
tmpPath
!=
relativePath
)
{
fs
.
unlinkSync
(
tmpPath
);
}
}).
catch
(
function
(
err
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment