summaryrefslogtreecommitdiff
path: root/TWiki/IncludeTopicsAndWebPages.mdwn
diff options
context:
space:
mode:
authorPeter Thoeny <web-hurd@gnu.org>2001-06-26 00:44:57 +0000
committerPeter Thoeny <web-hurd@gnu.org>2001-06-26 00:44:57 +0000
commit20f7de36b3b7bec634538e878fb5b10310ee9762 (patch)
tree5a54a5dff5c696d516de5547e86254d50b7fc37c /TWiki/IncludeTopicsAndWebPages.mdwn
parent9af5a434847b30b78a72b2ea295095e8ea42afb4 (diff)
none
Diffstat (limited to 'TWiki/IncludeTopicsAndWebPages.mdwn')
-rw-r--r--TWiki/IncludeTopicsAndWebPages.mdwn54
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>
+ &amp;lt;pre&amp;gt;
+ %<nop>INCLUDEURL{"http://domain/~qa/v1.1/REDTest.log.txt"}%
+ &amp;lt;/pre&amp;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&amp;d=v1&amp;o=t" pattern="^.\*?&gt;SUNW&lt;/a&gt;[^&lt;]+(.\*?)\\s+\\S+\\s+&lt;small.\*"\}%**</code><br />
+* You get:
+ * SUNW: %INCLUDE\{"http://finance.yahoo.com/q?s=SUNW&amp;d=v1&amp;o=t" pattern="^.\*?&gt;SUNW[^&lt;]+(.\*?)\\s+\\S+\\s+&lt;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]+\\&amp;ordm\\;F).\*"\}%**</code><br />
+* You get:
+ * San Francisco: %INCLUDE\{"http://weather.yahoo.com/forecast/San\_Francisco\_CA\_US\_f.html" pattern="^.\*?([0-9]+\\&amp;ordm\\;F).\*"\}%
+
+See also other [[TWikiVariables]].
+
+-- [[Main/PeterThoeny]] - 25 Jun 2001 <br />