<html><body><div><div>I have now implemented this and it looks gorgeous!</div><div><br></div><div>I changed the (:terminal:) directive to the shorter (:5250:) - which is the protocol name for these screens - and the delimiter to ~ and also found I had to re-specify the font for the <tt> elements, but then it worked a treat with out any other changes.</div><div><br></div><div>Thanks so much. I was sure it could be done but ran out of talent/time to make it happen on my own.</div><br class="Apple-interchange-newline"><br>On 21 Sep, 2012,at 02:05 PM, Petko Yotov <5ko@5ko.fr> wrote:<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch">Let's say you use the normal [@...@] markup for the terminal block, but <br> precede it with (:terminal:) so you'll have in a wiki page:<br> <br> (:terminal:) [@<br> here the 80x25 code<br> @]<br> <br> Then, to highlight/underline editable fields, you just insert some character <br> or combination which you know you wouldn't have in your terminal:<br> <br> (:terminal:)[@<br> Name . . : @@ @@ Code. . . : @@ @@<br> Date . . : @@ @@<br> @]<br> <br> In this example, I have used @@...@@ to delimit the editable zones. You can <br> change it to a different combination, even to a single character if you'll <br> never have it inside the terminal window.<br> <br> To achieve this, I have in config.php the following:<br> <br> Markup('terminal', '>markupend', "/\\(:terminal:\\) *\\[@(.*)@\\]/sei",<br> "MarkupTerminal(\$pagename, PSS('$1'))");<br> <br> function MarkupTerminal($pagename, $text) {<br> $delimiter = '@@';<br> $dx = preg_quote($delimiter, "/");<br> $text = preg_replace("/$dx(.*?)$dx/", '<tt>$1</tt>', $text);<br> return PreserveText('@', $text, '');<br> }<br> <br> <br> This will cause the @@...@@ text to be wrapped in <tt> tags, and save <br> everything in a <pre> block. So, in pub/css/local.css, I can add for <br> example:<br> <br> pre tt {background: #eee; text-decoration: underline;}<br> <br> See the result here:<br> <a href="http://galleries.accent.bg/Cookbook/Terminal" data-mce-href="http://galleries.accent.bg/Cookbook/Terminal">http://galleries.accent.bg/Cookbook/Terminal</a><br> <br> As you noticed in your message, inserting the delimiters of the editable <br> areas will shift the wikicode of that line, so editing may not be very nice.<br> <br> But if you can find a single character that will NEVER appear on your <br> terminal, use it as a delimiter, and you can even add 2 spaces in the <br> replacement, so everything will be aligned. Use something like this in <br> MarkupTerminal() :<br> <br> $delimiter = '@'; # single @...@ -or-<br> $delimiter = '_'; # single _..._ -or-<br> $delimiter = '$'; # single $...$<br> ...<br> $text = preg_replace("/$dx(.*?)$dx/", '<tt>$1 </tt>', $text);<br> # ^^2 spaces at the end<br> <br> This can be fun. :-)<br> <br> Petko<br> <br> <br> _______________________________________________<br> pmwiki-users mailing list<br> <a href="mailto:pmwiki-users@pmichaud.com" data-mce-href="mailto:pmwiki-users@pmichaud.com">pmwiki-users@pmichaud.com</a><br> <a href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users" data-mce-href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users">http://www.pmichaud.com/mailman/listinfo/pmwiki-users</a><br></div></div></blockquote></div></body></html>