PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: #}[Next]: #AutoTag
\ -> Commands -> #AsIs

#AsIs

This command is frequently used to allow you to #include real working code as examples. Any modifications required to get the file (or part of) to display "as is" occurs automatically as programmed by you.

Turning on "asis" mode basically allows you to read in text without PPWIZARD getting in the way. More than this is can simplify issues such as the fact that the viewer may not be able to display certain characters unless converted. For example a html viewer may have trouble with '<' characters unless they are converted to '&lt;'.

Turning "asis" mode on will modify a number of PPWIZARD #Options so that lines will get passed through "as is". This means blank lines are kept, line comment and continuation is ignored and a number of other options may be modified. Use "#Debug" to see all that are modified.

While #AsIs mode is turned on, PPWIZARD commands are still processed. This is fine if your examples either don't include ppwizard commands or you wish to conditionally include parts of the example. If you did not want this you would need to use the "HashPrefix" option or take some other action to prevent it.

You may need to do more than this to get the effect you desire. For example to have have the lines appear in a HTML browser as they do in your source you will need to do more work (or blank lines get removed and long lines wrap etc). The minimum you would require for HTML is to use <PRE> & </PRE> tags around the lines.

Using "<PRE>" as mentioned above only handles part of your issues with a HTML browser, any html tags such as "<P>" will get interpreted by the browser and generate a new paragraph. This is fine if that was your intention however you probably wish to see the characters "<P>" in the browser. You could make use of the "#AutoTag" or "#AsIs" autotagging facility to convert all occurrances of "<" to "&lt;".

Its normally more flexible to have basic autotagging such as that mentioned for the "<" character handled by this command and any extensions to the fundamental changes handled by the "#AutoTag" command. You would also wish to check out the "#AutoTagClear" & "#AutoTagState" commands.

There are some tricky bits that you may need to handle - such as how do you tell PPWIZARD where the end of the example code is. If you are not careful any end of example marker you place could get autotagged in such a way that PPWIZARD will not recogise it! This can be tricky, to see examples of how this can be handled, see my "OL_DOC.DH" header file which handles examples for IPF and HTML examples.

All AsIs tagging is performed before "#AutoTag" tagging. As mentioned earlier it can be difficult or impossible (in some situations) to escape out of an "example" mode that you set up. It will help you to remember that all autotagging is case sensitive and only occurs on data as it is read from a file (not on lines from memory/macros). If you don't get the results you expect you will need to use "#debug" or "/debug" to watch what occurs. In debug mode lines from a file are show in a similar manner to "0012:" where a line from memory could be shown as "####:".

Like autotagging you must be very careful in the order that you tag things for example specifing that '<' gets replaced with '&lt;' and then that '&' gets replaced with '&amp;' is wrong as you would be tagging the '&lt;' from the first replacement. For the example given here you would need to swap the order, in other cases you may need to use an intermediate 'unique' string and convert it back as the last change.

If possible try and group changes so that all single character changes are together this allows PPWIZARD to perform faster replacments as it can make good use of the BulkChar2String() routine.

Syntax

[WhiteSpace]#AsIs ["]SETUP["]  ["]NAME["]         OR
[WhiteSpace]#AsIs ["]OFF["]                       OR
[WhiteSpace]#AsIs ["]ON["]   [["]NAME1["]  ...]

The "SETUP" command is used to store all currently defined "#AutoTag" commands under the "NAME" you supply. The existing AutoTags are cleared.

The "OnOrOffCommand" specifies whether or not "asis" mode is on.

When turning #AsIs mode on you may specify one or more named sets of tags that were previously set up with "SETUP".

Example - SETUP

;--- Setup minimum tagging for IPF lines ---------------------------------
#AutoTagState +                        ;;Lets not effect current tags
#AutoTag      "&"   "&amp."
#AutoTag      ":"   "&colon."
#AsIs         SETUP IpfAsIsChanges     ;;Copy tags and clear (name tags "IpfAsIsChanges")
#AutoTagState -                        ;;Restore Original AutoTag state

Example - Including Example File

The following is an example of a macro which will display an example file with a nice border and title (in a table). The included file does not contain conditional commands etc (or if it does we want to see it as part of the example). This is one example of a macro you could use:

#define    IncludeExampleFile                    \
           <BR><TABLE BORDER=5 CELLSPACING=5>    \
           <TR>                                  \
           <TH ALIGN=LEFT>{$TEXT}                \
           </TR>                                 \
           <TR><TH ALIGN=LEFT>                   \
           <PRE>                                 \
           <FONT size=-1>                        \
           #AsIs       ON HtmlAsIsChanges        \
           #AutoTag    ON                        \
           #option     PUSH HashPrefix="#$@!"    \
           #$@!include "{$FILE}"                 \
           #$@!option  POP   ;;Restore Prefix    \
           #AutoTag    OFF                       \
           #AsIs       OFF                       \
           </FONT>                               \
           </PRE>                                \
           </TR>                                 \
           </TABLE>

Prior to using the above macro we need to have defined up the "HtmlAsIsChanges" tagging. This could have been done as follows:

#Autotagstate +                     ;;Lets not stuff up any existing autotags
#AutoTag '<' '&lt;'                 ;;Browser may not display text unless '<' etc changed.
#AutoTag '>' '&gt;'
#AsIs    SETUP     HtmlAsIsChanges  ;;Remember tagging we wish to take place
#Autotagstate -                     ;;Restore previous autotag state

Now lets use the above macro (and do some automatic tagging):

#AutoTagClear
#AutoTag  "REM "    '<A HREF="rem.htm">REM</A> '
#AutoTag  /SET /    *<A HREF="set.htm">SET</A> *
#AutoTag  "set "    ~<A HREF="set.htm">set</A> ~

<$IncludeExampleFile FILE="C:\AUTOEXEC.BAT" TEXT='Example file "C:\AUTOEXEC.BAT"'>

Note that in the example above all existing autotags were cleared before setting our own. This is restrictive and intelligent use of the "#AutoTagState" command will be more useful.


email me  any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Search][Prev]: #}[Next]: #AutoTag


PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Sunday November 05 2017 at 10:00am