Macro output includes line break if I use tiddler text as input

92 views
Skip to first unread message

Danielo Rodríguez

unread,
Feb 12, 2015, 2:57:18 AM2/12/15
to tiddl...@googlegroups.com
Hello,

I have a problem I don't know how to solve. I have a macro that should use some text as input to simply put it inside other text. This text is hold in a tiddler text field. But if I call the macro like this:

<$macrocall $name="bash-script" $output="text/plain" database={{$:/status/selected-db}}/>

Y get a carriage return in the output. The macro is something like this

```
nohup sqlplus -s $username/$pass@$database$>$HOME/reports/$(basename $0).csv<< EOF &
```

What can I do? I tried using transclude widget as input with inline mode, and also text widget. If I use any of those I get true instead of the text it should receive.

Thanks in advance.

Jeremy Ruston

unread,
Feb 12, 2015, 4:35:14 AM2/12/15
to TiddlyWiki
Hi Danielo

Could you perhaps share the full macro definition?

Best wishes

Jeremy

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Danielo Rodríguez

unread,
Feb 12, 2015, 6:19:42 AM2/12/15
to tiddl...@googlegroups.com, jeremy...@gmail.com
What I posted is mostly what it is, but I will post the entire tiddler. Maybe the fact that it is a exporter can change something:

title: $:/export/sqlplus-script
tags: $:/tags/Exporter
description: Export as sqlplus ready script
extension: .sh
icon: {{$:/core/images/import-button}}

\define renderContent()
{{{ $(exportFilter)$ ||$:/core/templates/plain-text-tiddler}}}
\end

\define bash-script(database:"rep_sasdb1")
```
#!/bin/bash
# This is an autonomous script.
# Copy it wherever you want inside your logserver home folder and give it execute permissions
read -p "Write your username: " username
read -s -p "Write your password: " pass
nohup sqlplus -s $username/$pass@$database$>$HOME/reports/$(basename $0).csv<< EOF &
set echo on
set pagesize 0
set verify off
set lines 32000
set trimspool on
set feedback off
```
\end

<$macrocall $name="bash-script" $output="text/plain" database={{$:/status/selected-db}}/>

<br>
<<renderContent>>
<br>

```
exit;
EOF
```

Tobias Beer

unread,
Feb 12, 2015, 7:07:37 AM2/12/15
to tiddl...@googlegroups.com, jeremy...@gmail.com
Hi Danielo,

Why would you be using output="text/plain"?
It seems to put everything on the same line.

Best wishes, Tobias.

Danielo Rodríguez

unread,
Feb 12, 2015, 9:12:52 AM2/12/15
to tiddl...@googlegroups.com, jeremy...@gmail.com
I tried with that to see if I can avoid the carriage return thing, but I got the same result.

I forgot to say that the value of the tiddler that holds the text to be add is set by a select widget. Can this be the reason? 

Danielo Rodríguez

unread,
Feb 12, 2015, 10:41:16 AM2/12/15
to tiddl...@googlegroups.com, jeremy...@gmail.com
Does anyone have an explanation for this? It is driving me crazy and I want to "deploy" what I have been working on

Danielo Rodríguez

unread,
Feb 12, 2015, 2:06:42 PM2/12/15
to tiddl...@googlegroups.com, jeremy...@gmail.com


El jueves, 12 de febrero de 2015, 16:41:16 (UTC+1), Danielo Rodríguez escribió:
Does anyone have an explanation for this? It is driving me crazy and I want to "deploy" what I have been working on

At the end this was not a TW problem but a problem with the editor I was using to create the tiddlers which adds automatically an end line to the file. 

Tobias Beer

unread,
Feb 12, 2015, 2:20:18 PM2/12/15
to tiddl...@googlegroups.com, jeremy...@gmail.com
At the end this was not a TW problem but a problem with the editor I was using to create the tiddlers which adds automatically an end line to the file. 

Anyone able / care to explain what's it with text editors adding (undesired) newlines to the end of a file?

Best wishes, Tobias.

Astrid Elocson

unread,
Feb 13, 2015, 7:22:58 AM2/13/15
to tiddl...@googlegroups.com

Tobias Beer

unread,
Feb 13, 2015, 11:13:19 AM2/13/15
to tiddl...@googlegroups.com

It seems a "convenience" requirement that is screwing things up a little too frequently.
Please write proper commandline tools, people.

Best wishes, Tobias.
Reply all
Reply to author
Forward
0 new messages