Tags:
create new tag
view all tags

SID-00208: Is there a "show only pre/verbatim text" plugin?

Status: Answered Answered TWiki version: Perl version: 5.8.8
Category: CategoryAddOns Server OS: CentOS 5.2/64, kernel 2.6.18 Last update: 17 years ago

I want to make a page that has a richly formatted and commented version of a script, which would have discussion and commentary interspersed with the body of the script. For a lame example:


First, we want to invoke a shell
#!/bin/bash
This could, of course, be any of a number of shells:
  • bash
  • ksh
  • zsh
and so on

Then we echo something:

echo "hello, world!"

and I'd like a plugin that, when I hit the button it puts on the page, all I get back is
#!/bin/bash
echo "hello, world!"
withough the interspersed non-pre (or verbatim) text.

Is this doable?

(Twiki says "This site is running TWiki version Wed, 08 Feb 2006 build 8740, Plugin API version 1.1". Yes. It's old.)

-- JbSegal - 19 Mar 2009

Discussion and Answer

The only thing that comes to mind is to put the commentary in HTML comment tags: you would only see those when in edit mode, in view mode would only see the verbatim text. Like so:

#!/bin/bash
echo "hello, world!"

After all, that's how we comment 'verbatim' HTML markup so that it isn't visible in the final version (a weak analogy, I know).

-- SeanCMorgan - 20 Mar 2009

You could write a ShowPrePlugin that expands a %SHOWPRE{}% variable.

Alternatively, try to enclose the pre text in named VarSTARTSECTION and VarENDSECTION, and then INCLUDE that section. A section may have many STARTSECTION and ENDSECTION pairs, they get merged into one block of text when included as long as the section name is the same.

-- PeterThoeny - 20 Mar 2009

I just read the code doc, a section must be unique, e.g. can't be split up into multiple sections. You can however define multiple sections, such as %STARTSECTION{code1}% ... %ENDSECTION{code1}%, %STARTSECTION{code2}% ... %ENDSECTION{code2}% etc, then %INCLUDE{}% one after the other. Not very user friendly. Your best bet is to create a special plugin that extracts verbatim text.

-- PeterThoeny - 20 Mar 2009

Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the TWiki consultants if you need timely help. We invite you to get involved with the community, it is more likely you get community support if you support the open source project!

-- PeterThoeny - 2009-05-02

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Is there a "show only pre/verbatim text" plugin?
SupportCategory CategoryAddOns
TWiki version

Server OS CentOS 5.2/64, kernel 2.6.18
Web server Apache 2.2.3
Perl version 5.8.8
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2009-05-02 - PeterThoeny
 
  • 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.