diff options
author | Peter Thoeny <web-hurd@gnu.org> | 2001-06-26 00:44:57 +0000 |
---|---|---|
committer | Peter Thoeny <web-hurd@gnu.org> | 2001-06-26 00:44:57 +0000 |
commit | 20f7de36b3b7bec634538e878fb5b10310ee9762 (patch) | |
tree | 5a54a5dff5c696d516de5547e86254d50b7fc37c | |
parent | 9af5a434847b30b78a72b2ea295095e8ea42afb4 (diff) |
none
-rw-r--r-- | TWiki/IncludeTopicsAndWebPages.mdwn | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/TWiki/IncludeTopicsAndWebPages.mdwn b/TWiki/IncludeTopicsAndWebPages.mdwn new file mode 100644 index 00000000..1390fce6 --- /dev/null +++ b/TWiki/IncludeTopicsAndWebPages.mdwn @@ -0,0 +1,54 @@ +**Include Topics and Web Pages Using <code>**%INCLUDE\{...\}%**</code> Variable** + +Use the <code>**%INCLUDE\{...\}%**</code> variable to embed the content of another topic or web page inside a %WIKITOOLNAME% topic. The whole content or only parts of a page can be included. + +%TOC% + +## <a name="Syntax"> Syntax </a> + +<code>**%INCLUDE\{"page" pattern="reg-exp"\}%**</code> + +* <code>**"page"**</code>: <br /> The nameless parameter specifies the page to include. It is + * The name of a topic located in the current web, i.e. <code>**%INCLUDE\{"WebNotify"\}%**</code> + * A `Web.Topic` name specifying a topic in another web, i.e. <code>**%INCLUDE\{"%TWIKIWEB%.TWikiWebsTable"\}%**</code> + * A full qualified URL with <code>**http**</code> protocol, domain name and optional port number, i.e. <code>**%INCLUDE\{"http://twiki.org:80/index.html"\}%**</code>. Supported content types are <code>**text/html**</code> and <code>**text/plain**</code>. The full page is included by default, but the HTML header and scripts are stripped in case it is a web page. + +* <code>**pattern="reg-exp"**</code>: <br /> The **pattern** parameter is optional and allows you to extract some parts of a web page. Specify a %TWIKIWEB%.RegularExpression that scans from start (`'^'`) to end and contains the text you want to keep in parenthesis, i.e. <code>**pattern="^.\*?(from here.\*?to here).\*"**</code>. You need to make sure that the integrity of a web page is not compromised, i.e. if you include a table make sure to include everything including the table end tag. + +**_Note:_** All text of a topic is included unless you specify <code>**%STARTINCLUDE%**</code>, <code>**%STOPINCLUDE%**</code> and/or a **pattern** parameter. + +## <a name="Usage_Examples"> Usage Examples </a> + +### <a name="1_Display_regression_test_result"> 1. Display regression test results in a TWiki page </a> + +<pre> + &lt;pre&gt; + %<nop>INCLUDEURL{"http://domain/~qa/v1.1/REDTest.log.txt"}% + &lt;/pre&gt; +</nop></pre> + +### <a name="2_Display_Yahoo_s_robot_txt_file"> 2. Display Yahoo's robot.txt file </a> + +* You type: + * <code>**%INCLUDE\{"http://www.yahoo.com/robots.txt"\}%**</code><br /> +* You get: + + %INCLUDE{"http://www.yahoo.com/robots.txt"}% + +### <a name="3_Display_the_SUNW_stock_quote_i"> </a> 3. Display the SUNW stock quote in a TWiki page + +* You type: + * <code>**SUNW: %INCLUDE\{"http://finance.yahoo.com/q?s=SUNW&d=v1&o=t" pattern="^.\*?>SUNW</a>[^<]+(.\*?)\\s+\\S+\\s+<small.\*"\}%**</code><br /> +* You get: + * SUNW: %INCLUDE\{"http://finance.yahoo.com/q?s=SUNW&d=v1&o=t" pattern="^.\*?>SUNW[^<]+(.\*?)\\s+\\S+\\s+<small.\*"\}% + +### <a name="4_Display_the_temperature_in_San"> 4. Display the temperature in San Francisco </a> + +* You type: + * <code>**San Francisco: %INCLUDE\{"http://weather.yahoo.com/forecast/San\_Francisco\_CA\_US\_f.html" pattern="^.\*?([0-9]+\\&ordm\\;F).\*"\}%**</code><br /> +* You get: + * San Francisco: %INCLUDE\{"http://weather.yahoo.com/forecast/San\_Francisco\_CA\_US\_f.html" pattern="^.\*?([0-9]+\\&ordm\\;F).\*"\}% + +See also other [[TWikiVariables]]. + +-- [[Main/PeterThoeny]] - 25 Jun 2001 <br /> |