Skip to content

Commit ecd22a6

Browse files
committed
cli: Don't try to infer backend from output filename if output is stdout
1 parent d6de06d commit ecd22a6

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

alectryon/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def infer_frontend(fpath):
483483
return infer_mode(fpath, "input", "--frontend", FRONTENDS_BY_EXTENSION)
484484

485485
def infer_backend(frontend, out_fpath):
486-
if out_fpath:
486+
if out_fpath and out_fpath != "-":
487487
return infer_mode(out_fpath, "output", "--backend", BACKENDS_BY_EXTENSION)
488488
return DEFAULT_BACKENDS[frontend]
489489

recipes/_output/tests/stylesheets.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ <h1 class="title">Stylesheets and Pygments stylesheets</h1>
2424
<p>To compile:</p>
2525
<pre class="literal-block">
2626
$ DOCUTILSCONFIG=tests/stylesheets.docutils.conf \
27-
alectryon stylesheets.v \
28-
--pygments-style emacs --backend webpage -o - \
27+
alectryon stylesheets.v --pygments-style emacs -o - \
2928
| sed -r '/^ *&lt;style type=&quot;text.css&quot;&gt;/,/^ *&lt;.style&gt;/ { /^ *&lt;style |&lt;.style&gt;|Alectryon/b; d}' \
3029
&gt; stylesheets.html
3130
# reST → HTML; produces ‘stylesheets.html’
3231

3332
$ DOCUTILSCONFIG=tests/stylesheets.docutils.conf \
34-
alectryon stylesheets.v \
35-
--pygments-style emacs --backend latex -o - \
33+
alectryon stylesheets.v --pygments-style emacs --backend latex -o - \
3634
| sed -r '/^% embedded stylesheet/,/^\\makeatother/ { /^\\makeat|Alectryon/b; d}' \
3735
&gt; stylesheets.part.tex
3836
# reST → LaTeX; produces ‘stylesheets.part.tex’

recipes/_output/tests/stylesheets.part.tex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@
5252
\begin{quote}
5353
\begin{alltt}
5454
$ DOCUTILSCONFIG=tests/stylesheets.docutils.conf \textbackslash{}
55-
alectryon stylesheets.v \textbackslash{}
56-
-{}-pygments-style emacs -{}-backend webpage -o - \textbackslash{}
55+
alectryon stylesheets.v -{}-pygments-style emacs -o - \textbackslash{}
5756
| sed -r '/^ *<style type="text.css">/,/^ *<.style>/ \{ /^ *<style |<.style>|Alectryon/b; d\}' \textbackslash{}
5857
> stylesheets.html
5958
# reST → HTML; produces ‘stylesheets.html’
6059
6160
$ DOCUTILSCONFIG=tests/stylesheets.docutils.conf \textbackslash{}
62-
alectryon stylesheets.v \textbackslash{}
63-
-{}-pygments-style emacs -{}-backend latex -o - \textbackslash{}
61+
alectryon stylesheets.v -{}-pygments-style emacs -{}-backend latex -o - \textbackslash{}
6462
| sed -r '/^% embedded stylesheet/,/^\textbackslash{}\textbackslash{}makeatother/ \{ /^\textbackslash{}\textbackslash{}makeat|Alectryon/b; d\}' \textbackslash{}
6563
> stylesheets.part.tex
6664
# reST → LaTeX; produces ‘stylesheets.part.tex’

recipes/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ _output/tests/screenshot.html: tests/screenshot.v
6969
# reST → HTML
7070
_output/tests/stylesheets.html: tests/stylesheets.v
7171
DOCUTILSCONFIG=tests/stylesheets.docutils.conf \
72-
$(alectryon) $< --pygments-style emacs --backend webpage -o - | sed -r '/^ *<style type="text.css">/,/^ *<.style>/ { /^ *<style |<.style>|Alectryon/b; d}' > $@
72+
$(alectryon) $< --pygments-style emacs -o - | sed -r '/^ *<style type="text.css">/,/^ *<.style>/ { /^ *<style |<.style>|Alectryon/b; d}' > $@
7373
# reST → LaTeX
7474
_output/tests/stylesheets.part.tex: tests/stylesheets.v
7575
DOCUTILSCONFIG=tests/stylesheets.docutils.conf \

recipes/tests/stylesheets.v

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
To compile::
77
88
$ DOCUTILSCONFIG=tests/stylesheets.docutils.conf \
9-
alectryon stylesheets.v \
10-
--pygments-style emacs --backend webpage -o - \
9+
alectryon stylesheets.v --pygments-style emacs -o - \
1110
| sed -r '/^ *<style type="text.css">/,/^ *<.style>/ { /^ *<style |<.style>|Alectryon/b; d}' \
1211
> stylesheets.html
1312
# reST → HTML; produces ‘stylesheets.html’
1413
1514
$ DOCUTILSCONFIG=tests/stylesheets.docutils.conf \
16-
alectryon stylesheets.v \
17-
--pygments-style emacs --backend latex -o - \
15+
alectryon stylesheets.v --pygments-style emacs --backend latex -o - \
1816
| sed -r '/^% embedded stylesheet/,/^\\makeatother/ { /^\\makeat|Alectryon/b; d}' \
1917
> stylesheets.part.tex
2018
# reST → LaTeX; produces ‘stylesheets.part.tex’

0 commit comments

Comments
 (0)