Tags:
archive_me1Add my vote for this tag create new tag
, view all tags
Whenever I'm writing up a document with some kind of command or code fragment in the middle of a line I like to wrap it with the HTML <CODE><B> tags, so that you get something like tar xvf somefile.tar. See how nice and easy that is to read? and it's monospaced, like you expect to see for some computer command or code.

So I made an ultra basic addition such that you use the '+' symbol in the very same way you use the '*' to make bold wiki text.

Somehow I imagine other people would like this shortcut too, so I propose it here. It's trivial to implement, just add the following line in extendGetRenderedVersionOutsidePRE (see, already an instance where I needed it!)

	 # render +text+ as "bold code" text:
	 s/(^|\s)\+([^\s].*?[^\s])\+(\s|$)/$1<CODE><B>$2<\/B><\/CODE>$3/go;

I guess the one downside is it uses the '+' symbol, which is precious from a future expansion standpoint (there are only so many useful symbols). On the other hand, if people like this feature some other shortcut such as +_ _+ might suffice.

Anyway, your thoughts are welcome, thanks!

-- MattWalsh - 18 Jan 2001

Good idea. I changed the syntax, IMO a double equal sign is easier to remember and to type. Type ==bold code== to get bold code.

Here is the rendering rule:

sub fixedFontText
{
	 my( $theText, $theDoBold ) = @_;
	 # preserve white space, so replace it by "  " patterns
	 $theText =~ s/\t/	/go;
	 $theText =~ s|((?:[\s]{2})+)([^\s])|'  ' x (length($1) / 2) . "$2"|eg;
	 if( $theDoBold ) {
		  return "<code><b>$theText</b></code>";
	 } else {
		  return "<code>$theText</code>";
	 }
}

sub getRenderedVersion
{
...snip...
	 s/([\s\(])==([^\s]+?|[^\s].*?[^\s])==([\s\,\.\;\:\!\?\)])/$1 . &fixedFontText( $2, 1 ) . $3/geo;
	 s/([\s\(])=([^\s]+?|[^\s].*?[^\s])=([\s\,\.\;\:\!\?\)])/$1 . &fixedFontText( $2, 0 ) . $3/geo;

Commited to TWikiAlphaRelease.

-- PeterThoeny - 21 Jan 2001

Thanks, great. I like that syntax even better!

-- MattWalsh - 22 Jan 2001

TopicClassification:
FeatureDone
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2001-01-22 - MattWalsh
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.