summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorwei <>2007-01-14 02:10:24 +0000
committerwei <>2007-01-14 02:10:24 +0000
commit45b0fe42a979d444d547a5248eb2e9e915aaf16a (patch)
tree2480dae3350e4a70949956c41984cceb8dce3efc /buildscripts
parent898049a4012eaecd99e7a418726215e656677809 (diff)
Add "block-content" to allow user comments on block level elements in quickstart docs.
Diffstat (limited to 'buildscripts')
-rw-r--r--buildscripts/chmbuilder/index.php7
-rw-r--r--buildscripts/texbuilder/Page2Tex.php48
-rw-r--r--buildscripts/texbuilder/quickstart/build.php4
3 files changed, 53 insertions, 6 deletions
diff --git a/buildscripts/chmbuilder/index.php b/buildscripts/chmbuilder/index.php
new file mode 100644
index 00000000..4330e1a9
--- /dev/null
+++ b/buildscripts/chmbuilder/index.php
@@ -0,0 +1,7 @@
+<?php
+include('../../framework/prado.php');
+ $app = new TApplication("classes");
+ $app->run();
+
+
+?> \ No newline at end of file
diff --git a/buildscripts/texbuilder/Page2Tex.php b/buildscripts/texbuilder/Page2Tex.php
index 5d9a2b81..2374647c 100644
--- a/buildscripts/texbuilder/Page2Tex.php
+++ b/buildscripts/texbuilder/Page2Tex.php
@@ -4,6 +4,9 @@ class Page2Tex
{
private $_current_page;
private static $header_count = 0;
+ private static $p_count=0;
+ private static $hil_count=0;
+ private $page_count=0;
private $_base;
private $_dir;
@@ -270,29 +273,66 @@ class Page2Tex
}
- function set_header_id($content)
+ function set_header_id($content, $j)
{
+ $this->page_count=$j;
$content = preg_replace_callback('/<h1>/', array($this,"h1"), $content);
$content = preg_replace_callback('/<h2>/', array($this,"h2"), $content);
$content = preg_replace_callback('/<h3>/', array($this,"h3"), $content);
+ $content = $this->set_block_content_id($content);
return $content;
}
function h1($matches)
{
- return "<h1 id=\"".(++self::$header_count)."\">";
+ $page = $this->page_count*1000;
+ return "<h1 id=\"".($page + (++self::$header_count))."\">";
}
function h2($matches)
{
- return "<h2 id=\"".(++self::$header_count)."\">";
+ $page = $this->page_count*1000;
+ return "<h2 id=\"".($page + (++self::$header_count))."\">";
}
function h3($matches)
{
- return "<h3 id=\"".(++self::$header_count)."\">";
+ $page = $this->page_count*1000;
+ return "<h3 id=\"".($page + (++self::$header_count))."\">";
+ }
+
+ function set_block_content_id($content)
+ {
+ $content = preg_replace_callback('/<p>/', array($this, 'add_p'), $content);
+ $content = preg_replace_callback('/<com:TTextHighlighter([^>]+)>/', array($this, 'hil'), $content);
+ return $content;
+ }
+
+ function hil($matches)
+ {
+ $id = ($this->page_count*10000) + (++self::$hil_count);
+ if(preg_match('/id="code-\d+"/i', $matches[1]))
+ {
+ $code = preg_replace('/id="code-(\d+)"/', 'id="code_$1"', $matches[0]);
+ //var_dump($code);
+ return $code;
+ }
+ else if(preg_match('/id="[^"]+"/i', $matches[1]))
+ {
+ return $matches[0];
+ }
+ else
+ {
+ $changes = str_replace('"source"', '"source block-content" id="code-'.$id.'"', $matches[0]);
+ return $changes;
+ }
}
+ function add_p($matches)
+ {
+ $page = $this->page_count*10000;
+ return "<p id=\"".($page + (++self::$p_count))."\" class=\"block-content\">";
+ }
}
?>
diff --git a/buildscripts/texbuilder/quickstart/build.php b/buildscripts/texbuilder/quickstart/build.php
index b5ee7841..2cee7fee 100644
--- a/buildscripts/texbuilder/quickstart/build.php
+++ b/buildscripts/texbuilder/quickstart/build.php
@@ -36,9 +36,9 @@ foreach($pages as $chapter => $sections)
$current_path = $page;
$parser->setCurrentPage($current_path);
- //add id to <h1>, <h2>, <3>
+ //add id to <h1>, <h2>, <h3> and <p>
$tmp_content = $parser->set_header_id(file_get_contents($page),$j++);
-// file_put_contents($page, $tmp_content);
+ file_put_contents($page, $tmp_content);
$content .= $parser->get_section_label($section);
$file_content = file_get_contents($page);