Trying to convert my old custom arara rule
I have a rule which worked with the old version of arara:
!config
# Open the every <filename>.<format> that can be opened
# The default for <filename> is the current file.
# The default for <format> is pdf.
# Sample usage:
# - if myfile.tex is the current file, all these open myfile.pdf
# % arara: showfile
# % arara: showfile {format: pdf}
# % arara: showfile {filename: myfile, format: pdf}
# and both these open myfile.log:
# % arara: showfile {format: log}
# % arara: showfile {filename: myfile, format: log}
#
identifier: showfile
name: showfile
commands:
- <arara> @{ isWindows( "cmd /c start", "xdg-open" ) } "@{ getBasename(file) }.@{format}"
arguments:
- identifier: format
flag: <arara> @{parameters.format}
default: pdf
According to New version of arara broke my custom rule I have changed it into:
!config
identifier: showfile
name: showfile
commands:
- command: <arara> @{ isWindows( "cmd /c start", "xdg-open" ) } "@{ getBasename(file) }.@{format}"
arguments:
- identifier: format
flag: <arara> @{parameters.format}
default: pdf
But if I run
arara main.tex
on a simple main.tex
:
% arara: pdflatex
% arara: showfile
documentclass{article}
begin{document}
Test
end{document}
I only get:
and the main.pdf
is not shown.
The task remains appended, and if I close the command prompt windows, I get:
Processing 'main.tex' (size: 98 bytes, last modified: 12/15/2018
19:40:31), please wait.
(PDFLaTeX) PDFLaTeX engine .............................. SUCCESS
(showfile) Unnamed task ................................. SUCCESS
Total: 339.97 seconds
<<< Process finished (PID=9956). (Exit code 0)
================ READY ================
arara
add a comment |
I have a rule which worked with the old version of arara:
!config
# Open the every <filename>.<format> that can be opened
# The default for <filename> is the current file.
# The default for <format> is pdf.
# Sample usage:
# - if myfile.tex is the current file, all these open myfile.pdf
# % arara: showfile
# % arara: showfile {format: pdf}
# % arara: showfile {filename: myfile, format: pdf}
# and both these open myfile.log:
# % arara: showfile {format: log}
# % arara: showfile {filename: myfile, format: log}
#
identifier: showfile
name: showfile
commands:
- <arara> @{ isWindows( "cmd /c start", "xdg-open" ) } "@{ getBasename(file) }.@{format}"
arguments:
- identifier: format
flag: <arara> @{parameters.format}
default: pdf
According to New version of arara broke my custom rule I have changed it into:
!config
identifier: showfile
name: showfile
commands:
- command: <arara> @{ isWindows( "cmd /c start", "xdg-open" ) } "@{ getBasename(file) }.@{format}"
arguments:
- identifier: format
flag: <arara> @{parameters.format}
default: pdf
But if I run
arara main.tex
on a simple main.tex
:
% arara: pdflatex
% arara: showfile
documentclass{article}
begin{document}
Test
end{document}
I only get:
and the main.pdf
is not shown.
The task remains appended, and if I close the command prompt windows, I get:
Processing 'main.tex' (size: 98 bytes, last modified: 12/15/2018
19:40:31), please wait.
(PDFLaTeX) PDFLaTeX engine .............................. SUCCESS
(showfile) Unnamed task ................................. SUCCESS
Total: 339.97 seconds
<<< Process finished (PID=9956). (Exit code 0)
================ READY ================
arara
add a comment |
I have a rule which worked with the old version of arara:
!config
# Open the every <filename>.<format> that can be opened
# The default for <filename> is the current file.
# The default for <format> is pdf.
# Sample usage:
# - if myfile.tex is the current file, all these open myfile.pdf
# % arara: showfile
# % arara: showfile {format: pdf}
# % arara: showfile {filename: myfile, format: pdf}
# and both these open myfile.log:
# % arara: showfile {format: log}
# % arara: showfile {filename: myfile, format: log}
#
identifier: showfile
name: showfile
commands:
- <arara> @{ isWindows( "cmd /c start", "xdg-open" ) } "@{ getBasename(file) }.@{format}"
arguments:
- identifier: format
flag: <arara> @{parameters.format}
default: pdf
According to New version of arara broke my custom rule I have changed it into:
!config
identifier: showfile
name: showfile
commands:
- command: <arara> @{ isWindows( "cmd /c start", "xdg-open" ) } "@{ getBasename(file) }.@{format}"
arguments:
- identifier: format
flag: <arara> @{parameters.format}
default: pdf
But if I run
arara main.tex
on a simple main.tex
:
% arara: pdflatex
% arara: showfile
documentclass{article}
begin{document}
Test
end{document}
I only get:
and the main.pdf
is not shown.
The task remains appended, and if I close the command prompt windows, I get:
Processing 'main.tex' (size: 98 bytes, last modified: 12/15/2018
19:40:31), please wait.
(PDFLaTeX) PDFLaTeX engine .............................. SUCCESS
(showfile) Unnamed task ................................. SUCCESS
Total: 339.97 seconds
<<< Process finished (PID=9956). (Exit code 0)
================ READY ================
arara
I have a rule which worked with the old version of arara:
!config
# Open the every <filename>.<format> that can be opened
# The default for <filename> is the current file.
# The default for <format> is pdf.
# Sample usage:
# - if myfile.tex is the current file, all these open myfile.pdf
# % arara: showfile
# % arara: showfile {format: pdf}
# % arara: showfile {filename: myfile, format: pdf}
# and both these open myfile.log:
# % arara: showfile {format: log}
# % arara: showfile {filename: myfile, format: log}
#
identifier: showfile
name: showfile
commands:
- <arara> @{ isWindows( "cmd /c start", "xdg-open" ) } "@{ getBasename(file) }.@{format}"
arguments:
- identifier: format
flag: <arara> @{parameters.format}
default: pdf
According to New version of arara broke my custom rule I have changed it into:
!config
identifier: showfile
name: showfile
commands:
- command: <arara> @{ isWindows( "cmd /c start", "xdg-open" ) } "@{ getBasename(file) }.@{format}"
arguments:
- identifier: format
flag: <arara> @{parameters.format}
default: pdf
But if I run
arara main.tex
on a simple main.tex
:
% arara: pdflatex
% arara: showfile
documentclass{article}
begin{document}
Test
end{document}
I only get:
and the main.pdf
is not shown.
The task remains appended, and if I close the command prompt windows, I get:
Processing 'main.tex' (size: 98 bytes, last modified: 12/15/2018
19:40:31), please wait.
(PDFLaTeX) PDFLaTeX engine .............................. SUCCESS
(showfile) Unnamed task ................................. SUCCESS
Total: 339.97 seconds
<<< Process finished (PID=9956). (Exit code 0)
================ READY ================
arara
arara
asked Dec 15 '18 at 18:56
CarLaTeXCarLaTeX
30.2k447127
30.2k447127
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Could you try this new rule?
!config
identifier: showfile
name: Display
commands:
- name: Show file
command: >
@{
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
view = getBasename(file) + '.' + format;
return getCommand(prefix, view);
}
arguments:
- identifier: format
flag: >
@{
return parameters.format;
}
default: pdf
Let me break the elements into sections:
!config
identifier: showfile
name: Display
Nothing new here, it's just the header: showfile
is the identifier to be used as directive in the source code, and Display
is the name to be printed as the main task in the terminal. :)
Moving on.
commands:
- name: Show file
Now, we have a list of subtasks associated with this rule. In our case, we just have one element in the list. Each element consists of a name and a proper command. Show file
is the name of this subtask and it will be displayed right after Display
(the task name) in the terminal.
command: >
The >
symbol denotes the folded style for scalars. I highly suggest taking a look at the arara
manual for a complete description of what it is. In short, it is a way of having multiple lines in a field (there's actually way more to that, but let's keep concepts easy to grasp for the uninitiated).
@{
I simply opened the orb tag (please refer to the manual for more details on this concept). The rule logic will be described inside this tag.
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
prefix
is a variable that holds the result of the following evaluation: if arara
is being executed under Windows, return a list of strings containing cmd
, /c
and start
. Otherwise, return a list containing only xdg-open
.
view = getBasename(file) + '.' + format;
In a similar fashion, view
is a variable that holds the basename of the file
reference plus a literal .
and the format, obtained from the rule argument of the same name.
return getCommand(prefix, view);
We now return a command composed of the prefix
variable (properly flattened during command construction, please refer to the manual for more details) and the view
variable. Introduced in version 4.0, the Command
type is a robust way of making the underlying system know what to do. It's way more reliable than raw strings (deprecated in this version and to be removed in later versions).
}
Now the orb tag is properly closed. Please mind the spaces that compose the folded representation of the current scalar. Otherwise, the YAML parsing will fail.
arguments:
Now we have the list of rule arguments, as usual. In our case, we only have one element, defined as follows.
- identifier: format
The argument name, to be used in the directive in the source code.
flag: >
@{
return parameters.format;
}
Again, I decided to use the folded style for scalar representation. In this case, the original representation in the OP's question is fine, it's just my personal preference. :)
default: pdf
Then we have here the default value if this particular argument is not explicitly specified in the directive.
That's it. :)
@CarLaTeX: done.:)
– Paulo Cereda
Dec 15 '18 at 19:30
Very detailed explanation, thanks!
– CarLaTeX
Dec 15 '18 at 19:33
Beautiful work :)
– cmhughes
Dec 15 '18 at 21:35
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466012%2ftrying-to-convert-my-old-custom-arara-rule%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Could you try this new rule?
!config
identifier: showfile
name: Display
commands:
- name: Show file
command: >
@{
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
view = getBasename(file) + '.' + format;
return getCommand(prefix, view);
}
arguments:
- identifier: format
flag: >
@{
return parameters.format;
}
default: pdf
Let me break the elements into sections:
!config
identifier: showfile
name: Display
Nothing new here, it's just the header: showfile
is the identifier to be used as directive in the source code, and Display
is the name to be printed as the main task in the terminal. :)
Moving on.
commands:
- name: Show file
Now, we have a list of subtasks associated with this rule. In our case, we just have one element in the list. Each element consists of a name and a proper command. Show file
is the name of this subtask and it will be displayed right after Display
(the task name) in the terminal.
command: >
The >
symbol denotes the folded style for scalars. I highly suggest taking a look at the arara
manual for a complete description of what it is. In short, it is a way of having multiple lines in a field (there's actually way more to that, but let's keep concepts easy to grasp for the uninitiated).
@{
I simply opened the orb tag (please refer to the manual for more details on this concept). The rule logic will be described inside this tag.
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
prefix
is a variable that holds the result of the following evaluation: if arara
is being executed under Windows, return a list of strings containing cmd
, /c
and start
. Otherwise, return a list containing only xdg-open
.
view = getBasename(file) + '.' + format;
In a similar fashion, view
is a variable that holds the basename of the file
reference plus a literal .
and the format, obtained from the rule argument of the same name.
return getCommand(prefix, view);
We now return a command composed of the prefix
variable (properly flattened during command construction, please refer to the manual for more details) and the view
variable. Introduced in version 4.0, the Command
type is a robust way of making the underlying system know what to do. It's way more reliable than raw strings (deprecated in this version and to be removed in later versions).
}
Now the orb tag is properly closed. Please mind the spaces that compose the folded representation of the current scalar. Otherwise, the YAML parsing will fail.
arguments:
Now we have the list of rule arguments, as usual. In our case, we only have one element, defined as follows.
- identifier: format
The argument name, to be used in the directive in the source code.
flag: >
@{
return parameters.format;
}
Again, I decided to use the folded style for scalar representation. In this case, the original representation in the OP's question is fine, it's just my personal preference. :)
default: pdf
Then we have here the default value if this particular argument is not explicitly specified in the directive.
That's it. :)
@CarLaTeX: done.:)
– Paulo Cereda
Dec 15 '18 at 19:30
Very detailed explanation, thanks!
– CarLaTeX
Dec 15 '18 at 19:33
Beautiful work :)
– cmhughes
Dec 15 '18 at 21:35
add a comment |
Could you try this new rule?
!config
identifier: showfile
name: Display
commands:
- name: Show file
command: >
@{
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
view = getBasename(file) + '.' + format;
return getCommand(prefix, view);
}
arguments:
- identifier: format
flag: >
@{
return parameters.format;
}
default: pdf
Let me break the elements into sections:
!config
identifier: showfile
name: Display
Nothing new here, it's just the header: showfile
is the identifier to be used as directive in the source code, and Display
is the name to be printed as the main task in the terminal. :)
Moving on.
commands:
- name: Show file
Now, we have a list of subtasks associated with this rule. In our case, we just have one element in the list. Each element consists of a name and a proper command. Show file
is the name of this subtask and it will be displayed right after Display
(the task name) in the terminal.
command: >
The >
symbol denotes the folded style for scalars. I highly suggest taking a look at the arara
manual for a complete description of what it is. In short, it is a way of having multiple lines in a field (there's actually way more to that, but let's keep concepts easy to grasp for the uninitiated).
@{
I simply opened the orb tag (please refer to the manual for more details on this concept). The rule logic will be described inside this tag.
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
prefix
is a variable that holds the result of the following evaluation: if arara
is being executed under Windows, return a list of strings containing cmd
, /c
and start
. Otherwise, return a list containing only xdg-open
.
view = getBasename(file) + '.' + format;
In a similar fashion, view
is a variable that holds the basename of the file
reference plus a literal .
and the format, obtained from the rule argument of the same name.
return getCommand(prefix, view);
We now return a command composed of the prefix
variable (properly flattened during command construction, please refer to the manual for more details) and the view
variable. Introduced in version 4.0, the Command
type is a robust way of making the underlying system know what to do. It's way more reliable than raw strings (deprecated in this version and to be removed in later versions).
}
Now the orb tag is properly closed. Please mind the spaces that compose the folded representation of the current scalar. Otherwise, the YAML parsing will fail.
arguments:
Now we have the list of rule arguments, as usual. In our case, we only have one element, defined as follows.
- identifier: format
The argument name, to be used in the directive in the source code.
flag: >
@{
return parameters.format;
}
Again, I decided to use the folded style for scalar representation. In this case, the original representation in the OP's question is fine, it's just my personal preference. :)
default: pdf
Then we have here the default value if this particular argument is not explicitly specified in the directive.
That's it. :)
@CarLaTeX: done.:)
– Paulo Cereda
Dec 15 '18 at 19:30
Very detailed explanation, thanks!
– CarLaTeX
Dec 15 '18 at 19:33
Beautiful work :)
– cmhughes
Dec 15 '18 at 21:35
add a comment |
Could you try this new rule?
!config
identifier: showfile
name: Display
commands:
- name: Show file
command: >
@{
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
view = getBasename(file) + '.' + format;
return getCommand(prefix, view);
}
arguments:
- identifier: format
flag: >
@{
return parameters.format;
}
default: pdf
Let me break the elements into sections:
!config
identifier: showfile
name: Display
Nothing new here, it's just the header: showfile
is the identifier to be used as directive in the source code, and Display
is the name to be printed as the main task in the terminal. :)
Moving on.
commands:
- name: Show file
Now, we have a list of subtasks associated with this rule. In our case, we just have one element in the list. Each element consists of a name and a proper command. Show file
is the name of this subtask and it will be displayed right after Display
(the task name) in the terminal.
command: >
The >
symbol denotes the folded style for scalars. I highly suggest taking a look at the arara
manual for a complete description of what it is. In short, it is a way of having multiple lines in a field (there's actually way more to that, but let's keep concepts easy to grasp for the uninitiated).
@{
I simply opened the orb tag (please refer to the manual for more details on this concept). The rule logic will be described inside this tag.
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
prefix
is a variable that holds the result of the following evaluation: if arara
is being executed under Windows, return a list of strings containing cmd
, /c
and start
. Otherwise, return a list containing only xdg-open
.
view = getBasename(file) + '.' + format;
In a similar fashion, view
is a variable that holds the basename of the file
reference plus a literal .
and the format, obtained from the rule argument of the same name.
return getCommand(prefix, view);
We now return a command composed of the prefix
variable (properly flattened during command construction, please refer to the manual for more details) and the view
variable. Introduced in version 4.0, the Command
type is a robust way of making the underlying system know what to do. It's way more reliable than raw strings (deprecated in this version and to be removed in later versions).
}
Now the orb tag is properly closed. Please mind the spaces that compose the folded representation of the current scalar. Otherwise, the YAML parsing will fail.
arguments:
Now we have the list of rule arguments, as usual. In our case, we only have one element, defined as follows.
- identifier: format
The argument name, to be used in the directive in the source code.
flag: >
@{
return parameters.format;
}
Again, I decided to use the folded style for scalar representation. In this case, the original representation in the OP's question is fine, it's just my personal preference. :)
default: pdf
Then we have here the default value if this particular argument is not explicitly specified in the directive.
That's it. :)
Could you try this new rule?
!config
identifier: showfile
name: Display
commands:
- name: Show file
command: >
@{
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
view = getBasename(file) + '.' + format;
return getCommand(prefix, view);
}
arguments:
- identifier: format
flag: >
@{
return parameters.format;
}
default: pdf
Let me break the elements into sections:
!config
identifier: showfile
name: Display
Nothing new here, it's just the header: showfile
is the identifier to be used as directive in the source code, and Display
is the name to be printed as the main task in the terminal. :)
Moving on.
commands:
- name: Show file
Now, we have a list of subtasks associated with this rule. In our case, we just have one element in the list. Each element consists of a name and a proper command. Show file
is the name of this subtask and it will be displayed right after Display
(the task name) in the terminal.
command: >
The >
symbol denotes the folded style for scalars. I highly suggest taking a look at the arara
manual for a complete description of what it is. In short, it is a way of having multiple lines in a field (there's actually way more to that, but let's keep concepts easy to grasp for the uninitiated).
@{
I simply opened the orb tag (please refer to the manual for more details on this concept). The rule logic will be described inside this tag.
prefix = isWindows( [ 'cmd', '/c', 'start' ], [ 'xdg-open' ] );
prefix
is a variable that holds the result of the following evaluation: if arara
is being executed under Windows, return a list of strings containing cmd
, /c
and start
. Otherwise, return a list containing only xdg-open
.
view = getBasename(file) + '.' + format;
In a similar fashion, view
is a variable that holds the basename of the file
reference plus a literal .
and the format, obtained from the rule argument of the same name.
return getCommand(prefix, view);
We now return a command composed of the prefix
variable (properly flattened during command construction, please refer to the manual for more details) and the view
variable. Introduced in version 4.0, the Command
type is a robust way of making the underlying system know what to do. It's way more reliable than raw strings (deprecated in this version and to be removed in later versions).
}
Now the orb tag is properly closed. Please mind the spaces that compose the folded representation of the current scalar. Otherwise, the YAML parsing will fail.
arguments:
Now we have the list of rule arguments, as usual. In our case, we only have one element, defined as follows.
- identifier: format
The argument name, to be used in the directive in the source code.
flag: >
@{
return parameters.format;
}
Again, I decided to use the folded style for scalar representation. In this case, the original representation in the OP's question is fine, it's just my personal preference. :)
default: pdf
Then we have here the default value if this particular argument is not explicitly specified in the directive.
That's it. :)
edited Dec 15 '18 at 19:30
answered Dec 15 '18 at 19:08
Paulo CeredaPaulo Cereda
33.3k8125209
33.3k8125209
@CarLaTeX: done.:)
– Paulo Cereda
Dec 15 '18 at 19:30
Very detailed explanation, thanks!
– CarLaTeX
Dec 15 '18 at 19:33
Beautiful work :)
– cmhughes
Dec 15 '18 at 21:35
add a comment |
@CarLaTeX: done.:)
– Paulo Cereda
Dec 15 '18 at 19:30
Very detailed explanation, thanks!
– CarLaTeX
Dec 15 '18 at 19:33
Beautiful work :)
– cmhughes
Dec 15 '18 at 21:35
@CarLaTeX: done.
:)
– Paulo Cereda
Dec 15 '18 at 19:30
@CarLaTeX: done.
:)
– Paulo Cereda
Dec 15 '18 at 19:30
Very detailed explanation, thanks!
– CarLaTeX
Dec 15 '18 at 19:33
Very detailed explanation, thanks!
– CarLaTeX
Dec 15 '18 at 19:33
Beautiful work :)
– cmhughes
Dec 15 '18 at 21:35
Beautiful work :)
– cmhughes
Dec 15 '18 at 21:35
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f466012%2ftrying-to-convert-my-old-custom-arara-rule%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown