(Remake of previous) I need to center code, and turn off the formatting.

154 views
Skip to first unread message

j3d1H

unread,
Apr 8, 2017, 11:14:45 AM4/8/17
to tiddl...@googlegroups.com
I know this sounds like a contradiction, but what I'm trying to do is make code (as it has underscores, it's ASCII art) that centers. I want to have it have the code border, too, so yeah. Here's the ASCII art in question:

 __       __)                       / 
(, )  |  /     /)                  /  
   | /| /  _  // _  ______    _   /   
   |/ |/ _(/_(/_(__(_) // (__(/_ o    
   /  |

(It's Invita, from Figlet)
And I want to surround it with triple whatever-these-are: `
But centered. Is there a way to do this? (I do know that it will mess up a bit, as it tries to center it, but I can use whitespace to mess with that.)

EDIT: I know the ASCII art looks messed up, but it looks fine in TiddlyWiki, so that is correct.

@TiddlyTweeter

unread,
Apr 8, 2017, 1:46:50 PM4/8/17
to tiddl...@googlegroups.com
It still a bit unclear what you trying to do.

For ASCII art its advisable to ENFORCE mono-spaced font. Probably, also reduce the font size so the visuals hit better.

There is a general mechanism in TW that lets you style individual tiddlers anyway you want: http://tiddlywiki.com/prerelease/#How%20to%20apply%20custom%20styles%20by%20tag

If you need to centre the design wrap it in a div with a class and centre it.

Best wishes
Josiah

Mark S.

unread,
Apr 8, 2017, 3:41:14 PM4/8/17
to TiddlyWiki
This works if you set the tiddler type to text/html:

<div style="text-align:center;display:inline">
<div style="font-family:monospace;white-space:pre;">


 __       __)                       /
(, )  |  /     /)                  /  
   | /| /  _  // _  ______    _   /  
   |/ |/ _(/_(/_(__(_) // (__(/_ o    
   /  |
</div></div>


The standard tiddler format arbitrarily "eats" whitespace and interprets some of those forward slashes as tag markers. I'm guessing that the TW5 parser is getting mixed up by the forward slashes when looking for embedded HTML.

HTH
Mark

j3d1H

unread,
Apr 10, 2017, 8:53:49 PM4/10/17
to TiddlyWiki
I know this may sound weird, but I need to have formatting on other sections. text/html format won't work; I need something like the code (monospace and no formatting, no whitespace eating), but centered, and only a section of the tiddler.

PMario

unread,
Apr 11, 2017, 3:04:42 AM4/11/17
to TiddlyWiki
Hi j3d1H,

The easiest way IMO is to create a little template tiddler, that can be used for transclusions.

eg: 3 tiddlers

the template - named ASCII

<div style="text-align:center;display:inline">
<div style="font-family:monospace;white-space:pre;">
<$view>
</div></div>


the content  - named: test    content-type:  text/plain

 __       __)                       /
(, )  |  /     /)                  /  
   | /| /  _  // _  ______    _   /  
   |/ |/ _(/_(/_(__(_) // (__(/_ o    
   /  |

usage - named: usage-test

{{test||ASCII}}


have fun!
mario

PMario

unread,
Apr 11, 2017, 3:05:48 AM4/11/17
to TiddlyWiki
The template can be simplified but that's an other topic.

-m

PMario

unread,
Apr 11, 2017, 3:19:40 AM4/11/17
to tiddl...@googlegroups.com
Hi,

I did play a little bit with your "text-align" center settings. ... That doesn't work. ... The element needs to be centered, not the text. .... more testing needed.

others may jump in.

-m

PMario

unread,
Apr 11, 2017, 3:35:20 AM4/11/17
to TiddlyWiki

j3d1H

unread,
Apr 11, 2017, 10:46:40 AM4/11/17
to TiddlyWiki
Thank you! This works perfectly.

j3d1H

unread,
Apr 11, 2017, 8:59:17 PM4/11/17
to TiddlyWiki
Question about this site, I know it doesn't belong here, but how do I mark this as done and dusted? I think I saw it once, but I don't remember where.

@TiddlyTweeter

unread,
Apr 12, 2017, 8:01:32 AM4/12/17
to TiddlyWiki
I don't think you can do that as the author of the thread.

PMario has marked it so.

Best wishes
Josiah

PMario

unread,
Apr 13, 2017, 4:40:50 AM4/13/17
to TiddlyWiki
On Wednesday, April 12, 2017 at 2:01:32 PM UTC+2, @TiddlyTweeter wrote:
I don't think you can do that as the author of the thread.

I thought everyone can mark a thread as completed. ... but it may be bound to some user settings.
 
PMario has marked it so.

.. I did.

-m
Reply all
Reply to author
Forward
0 new messages