Possible bug in the way plaintext cards are treated?

Support Ticket

+status
+tags
 

Well, I might as well say it... all I really want is for wagn to do simple text replacements via nests.

"If I write this piece of text on one line I expect it to behave the same way when put back together via nests."

 

For example:

 

"If I write this piece of text on one line {+expectation} when {+action}."

+expectation

I expect it to behave the same way

 

+action

 put back together via nests

Right now if one uses Basic cards wrap their content in the P, paragraph tag so I switched to using PlainText.

PlainText (in spite of the name) seems to add carrige returns before and after each nest, carrige returns I didn't add myself.

I then switch to Phrases which seem to get the job done, but sometimes they too receive a carrige return but only in the first nest, but are unfit to hold formatted text in the long run.

 

Can this be fixed? I don't know if this has repercussions, maybe a new type can be created, but that seems a little overkill.

 

It would be great if this worked, as a nest is nothing more than hard coded text search and replacement via named fields, something like a key value pair made up of the name of the card and it's content.

 

What is the view on the inclusion? I think default would be :content, vs. :raw or :core which are really expected not to be wrapped in any way.

--Gerry Gleason.....2015-05-04 12:31:41 +0000

a nest is nothing more than hard-coded text search and replacement via named fields

...well, as Gerry implies, that depends on the view. The default "content" view is more than that – it also includes a wrapper that makes it dynamic. The wrapper is a div by default.

So your options are (a) pick a view without the wrapper (eg core), or (b) tweak the CSS of the wrapper to your liking. In the case of plain text, there's really only one CSS rule that comes standard:

 pre,
.TYPE-plain_text.card-content,
.SELF-Xhead.card-content {
  white-space: pre-wrap;       /* css-3 */
  white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
  white-space: -pre-wrap;      /* Opera 4-6 */
  white-space: -o-pre-wrap;    /* Opera 7 */
  word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

You might have to tweak those rules to get what you want, but they're useful in getting the whitespace handling that is typically desired in multi-line plaintext.

--Ethan McCutchen.....2015-05-04 21:46:23 +0000

I was thinking that PlainText would be enough but I ran about six other simulations/tests with my content and it's a no go. Essentially I need it to retain (HTML)formatting, still be dynamic so I can double click on it to edit and still be able to surgically break it apart in cards that I need to view together. So I'm back to "Basic" or HTML cards(they render fine but can't be edited WYSIWYG).

 

Is it possible, for me, to use a span wrapper for the content wrapper instead of "The wrapper is a div by default."? Span has no detectable presence unlike div.

 

PS. Also noted that some card types seem to make assumptions about how to display the content but in rather peculiar ways. For example, when creating a Pointer Card and then entering Another Card for it to point to, adding the Pointer Card to other content makes it display a closed, one line description of the card it points to. This seems rather unnecessary to have in the default behavior, since all one wants is for the Pointer Card to point to whatever card it is pointing to and display the default of that whatever that may be. Right now it feel like I find myself overriding Pointer Cards constantly. Is there an assumption I'm missing here?

--Mir S......2015-05-06 18:51:46 +0000

Well, the default view is closed for items, but you can change it if you want. That default is a bit historical, as the main open/closed views were the primary way to represent a referenced card in place. You can give any view options for the items, they go after the second | in include syntax. If you want links to the pointed to cards, {{my pointer| | link}}. Changing div to span in a standard view is only done by code (modules), and I really wouldn't recommend that change anyway.

I think what Ethan is suggesting would change the style of div so that it acts like a span, which is probably the display attribute. I'm pretty sure a few styles is the main difference between div and span. If you just inspect the div element, you'll find the classes you'll want to use that are connected to the Sets the card is in.

The default view is probably a setting now (and the default item view as well), right?

--Gerry Gleason.....2015-05-09 15:27:04 +0000

Re span, that wouldn't work for *all* card slots, because card slots often have block elements (like divs) inside them, and it's not technically legal in HTML to have block elements inside of inline elements. Different browsers handle code that breaks this rule differently, so it causes all kinds of problems.

We could consider making it so that content nests default to span, but lots of card content has block elements in it, so that's not a great solution either, though this is slightly more appealing now that (in new decks) the default view is titled, not content. Could also do a different view. Worth a conversation. (probably in a separate idea card).

We have also discussed changing the default item view to "link". I think that's been ticketed; there was general agreement on this. But there hasn't really been a good plan for how to migrate old decks yet.

--Ethan McCutchen.....2015-05-10 03:59:39 +0000