Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

c tags

by demerphq (Chancellor)
on Jun 10, 2005 at 18:26 UTC ( #465633=monkdiscuss: print w/replies, xml ) Need Help??

Just so people know, there is now a shortcut for 'code' tags. You can use <c></c> instead of <code></code> You can't mix the forms however: <c></code> would not end the <c> tag section until a </c> was encountered. This means that you can put <c> tags inside of <code> tags and vice versa. In all other respects the tags are identical. Enjoy.


Replies are listed 'Best First'.
Re: c tags
by atcroft (Monsignor) on Jun 11, 2005 at 22:53 UTC

    I modified my local copy of FrameChat2 (v. 2.04) to use the <c></c> shortcut for <code></code> tags. Below is the diff (`diff -u` - the unmodified version being named I cannot recall, though, if I had modified it previously in a way that would result in differing line numbers. Thought maybe it might prove helpful to someone, though.

    --- Sat Jun 11 16:41:08 2005 +++ Sat Jun 11 17:41:16 2005 @@ -126,6 +126,7 @@ '[http://] ', '[ftp://] ', '<code>&lt;/code> ', +'<c>&lt;/c> ', '<tt></tt> ', '<a href=""></a> ', '/ignore ', @@ -912,6 +913,8 @@ $content=~s/<code>(.*?)<\/code>/codefix($1)/eig; # encodes the code +and changes pairs of balanced 'code' tags to 'ccc' $content=~s/(<\/?code>)/encode_entities($1)/eig; # nuke unbalanced c +ode tags + $content=~s/<c>(.*?)<\/c>/codefix($1)/eig; # encodes the c tag and c +hanges pairs of balanced 'c' tags to 'ccc' + $content=~s/(<\/?c>)/encode_entities($1)/eig; # nuke unbalanced c ta +gs $content=~s/<ccc>/<code>/ig; # restore <ccc> $content=~s/<\/ccc>/<\/code>/ig; # restore </ccc> @@ -967,10 +970,10 @@ } if(($i{'n'} && $i{'n'} =~ /^hist|(?:view|search) history$/) || $i{'hi +stbyauth'}){ - $content=~s/(<(?!(a\s|tt>|code>|i>|\/a>|\/tt>|\/code>|\/i>)))/encode +_entities($1)/eig; # only allow a, tt, i & code tags + $content=~s/(<(?!(a\s|tt>|code>|c>|i>|\/a>|\/tt>|\/code>|\/c>|\/i>)) +)/encode_entities($1)/eig; # only allow a, tt, i & code/c tags } else{ - $content=~s/(<(?!(a\s|tt>|code>|\/a>|\/tt>|\/code>)))/encode_entitie +s($1)/eig; # or only allow a, tt & code tags + $content=~s/(<(?!(a\s|tt>|code>|c>|\/a>|\/tt>|\/code>|\/c>)))/encode +_entities($1)/eig; # or only allow a, tt & code/c tags } return $content; }
Re: c tags
by gaal (Parson) on Jun 11, 2005 at 09:09 UTC

    I know there's a chance this would be seen as creature freep, but can we please also have a <pc>...</pc> tag that means <p><code>...</code></p>? I do that a lot!

      You can already do something similar that with less typing - even if I've to admit that you don't get full <p> tags.

      Here comes a EMBEDDED <c> tag; but if I put a

      , like
      some non-code text <c><<NEWLINE HERE>> Code text here</c> other text, in another paragraph...
      it seems to understand me!

      Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

      Don't fool yourself.

      If you do that (not including a newline inside the code tags), it means that your code doesn't wrap as effectively and it gets downloaded as a comment.

      If you instead, as frodo72 notes, include a newline inside of the code tags (for example, at the start and/or the end of the code), then the displayed code will be enclosed in P or PRE tags, depending on the viewer's settings. Wrapping your own P tags around such shouldn't be done.

      - tye        

        Thanks. Is this documented?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://465633]
Approved by Corion
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2017-06-25 14:07 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (567 votes). Check out past polls.