Re: [tw5] Re: Macro call question

46 views
Skip to first unread message

Jeremy Ruston

unread,
Mar 26, 2021, 4:37:24 AM3/26/21
to tiddl...@googlegroups.com
Hi Damon

By default the wikify widget parses the text using "block" mode, where paragraphs are generated, and block formatting like headings and list are recognised. You can force "inline" mode with the "mode" attribute:


Best wishes

Jeremy


On 25 Mar 2021, at 22:48, History Buff <damon.p...@gmail.com> wrote:

Alright, that seems to do the trick for the most part.

I do have a question though. Using the wikify widget with the output set to html puts a leading <p> and trailing </p> around the text I enter. This normally wouldn't be a big deal, but since this is ultimately ending up in a table cell, it causes the row to be higher than it would otherwise which I don't care for. Is it possible for these paragraph tags to not be generated? If not, then is there another way to do what I want to do? 

Here's the wikify code and the macro for adding the span tags I ended up with: 

\define newtext(text)
  <span class="trtooltip">Hover...
    <span class="trtooltiptext">
      $text$
    </span>
  </span>
\end

<$wikify name=text text="""<$macrocall $name=newtext text=<<notes>> />""" output=html >

Any help would be greatly appreciated.

Damon

On Thursday, March 25, 2021 at 10:11:52 AM UTC-7 History Buff wrote:
After a bit of research, I discovered the output parameter of the wikify widget. I hadn't noticed that when I had tried wikify before. If I set the output to html, then I seem to get exactly what I want (at least in the experiment that I did). I will next try it in my mileage macro to make sure.

I'm still open to any comments or suggestions on improvements of my macro.

On Thursday, March 25, 2021 at 9:41:42 AM UTC-7 History Buff wrote:
One more thing I should point out is that the above only works if I type in the text in the notes area first and then select from the drop downs. If I do a dropdown first, all of the default text disappears so this really isn't an optimal solution.

On Wednesday, March 24, 2021 at 2:34:33 PM UTC-7 History Buff wrote:
Greetings smart people,

I'm trying to generate a form where one of the input areas ends up in a tooltip (the notes and sources area). I've got a working model, but I don't like the way it's implemented. It seems like there should be a more elegant way to do it, but I haven't found a working solution after a few hours of fiddling. The screenshot shows the form with my ugly way where I use the default text parameter to include the spans for the tooltip and the actual input is between them. What I want is to have a macro that adds these spans and I don't have to have them visible. The code I'm currently using to generate this is below the screenshot. I've defined a macro that I think will work at the top, but I haven't been able figure out a way to invoke it and have it work. Any help would be greatly appreciated.

Screenshot 2021-03-24 142940.png

\define newtitle(name,date)
  $name$ ($date$)
\end
\define newtext(text)
  <span class="trtooltip">Hover...
  <span class="trtooltiptext">
  $text$
  </span>
  </span>
\end
\define NewMileageEntry()
  <$vars
    temp="$:/temp/NewEntry">
    Company Performing Activity: <$select tiddler=<<temp>> field=company tooltip="Select Company">
      <$list filter='[!is[system]tag[Railroads]]'>
        <option><$view field='title'/></option>
      </$list>
    </$select>
  <p/>
    Mileage Received From: <$select tiddler=<<temp>> field=from tooltip="Select railroad that mileage was received from">
      <$list filter='[!is[system]tag[Railroads]]'>
        <option><$view field='title'/></option>
      </$list>
    </$select>
  <p/>
    Mileage Transferred To: <$select tiddler=<<temp>> field=to tooltip="Select railroad receiving the mileage">
      <$list filter='[!is[system]tag[Railroads]]'>
        <option><$view field='title'/></option>
      </$list>
    </$select>
  <p/>
    Date: <$edit-text
      tiddler=<<temp>>
      field=date
      class=fieldinput
      tag=input
      size=12
      placeholder="yyyy-mm-dd"
    />
  <p/>
    Mileage: <$edit-text
      tiddler=<<temp>>
      field=mileage
      class=fieldinput
      tag=input
      size=8
    />&emsp;
   Not in Kansas? <$checkbox tiddler=<<temp>> field="outofstate" checked="yes" unchecked="" default=""></$checkbox>
   <p/>
    (C)onstructed, (A)bandoned, (S)old, (L)eased, (R)eclassified: <$edit-text
      tiddler=<<temp>>
      field=mileagetype
      class=fieldinput
      tag=input
      size=4
    />
  <p/>
    Origin: <$edit-text
      tiddler=<<temp>>
      field=origin
      class=fieldinput
      tag=input
      size=72
    />
  <p/>
    Destination: <$edit-text
      tiddler=<<temp>>
      field=destination
      class=fieldinput
      tag=input
      size=72
    />
  <p/>
  Notes, Sources, etc.:
    <$edit-text
      tiddler=<<temp>>
      field=notes
      class=fieldarea
      tag=textarea
  default="""<span class="trtooltip">Hover...
  <span class="trtooltiptext">
Enter your text here.
  </span>
</span>"""
    />
  <p/>
    <$button tooltip="save input" > {{$:/images/train-track}} Add New Mileage
      <$vars
        date={{{ [title<temp>get[date]] }}}
        mileage={{{ [title<temp>get[mileage]] }}}
        mileagetype={{{ [title<temp>get[mileagetype]] }}}
        outofstate={{{ [title<temp>get[outofstate]] }}}
        origin={{{ [title<temp>get[origin]] }}}
        destination={{{ [title<temp>get[destination]] }}}
        notes={{{ [title<temp>get[notes]] }}}
        company={{{ [title<temp>get[company]] }}}
        source={{{ [title<temp>get[source]] }}}
        from={{{ [title<temp>get[from]] }}}
        to={{{ [title<temp>get[to]] }}} >
      <$wikify name=tidname text="""<$macrocall $name=newtitle name=<<company>> date=<<date>> />""">
        <$set name="namelink" filter="[title<company>]">
          <$set name="fromlink" filter="[title<from>]">
          <$set name="tolink" filter="[title<to>]">
            <$action-createtiddler
              $basetitle=<<tidname>>
              date=<<date>>
              mileage=<<mileage>>
              mileagetype=<<mileagetype>>
              origin=<<origin>>
              outofstate=<<outofstate>>
              destination=<<destination>>
              tags=<<namelink>>
              company=<<namelink>>
              from=<<fromlink>>
              to=<<tolink>>
              text=<<notes>> />
          </$set>
          </$set>
        </$set>
      </$wikify>
      </$vars>
      <$action-deletetiddler $filter="[<temp>]" />
    </$button>
    <$button tooltip="cancel input"> {{$:/core/images/cancel-button}} Clear Entries
      <$action-deletetiddler $filter="[<temp>]" />
    </$button>
  </$vars>
\end

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/66f2acd4-4190-448a-9e39-94e615b76350n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages