Revision history for TableOfContentsPseudoAction


Revision [22979]

Last edited on 2016-05-20 07:38:43 by FatherNitwit [Replaces old-style internal links with new pipe-split links.]
Additions:
I've just removed the code. This code derived from CitiWiki (with some modifications made by me), a WakkaWiki fork licensed under the BSD license. The TableOfContentsPseudoAction was originally developed by Costal Martignier for [[http://comawiki.org/CoMa.php?CoMa=StartSeite | CoMaWiki]], which is release under a non-free license.
Since I used that code for [[http://uniwakka.sourceforge.net | UniWakka]] I decided to contact Costal for information about its origin, and he told me he did not give permission to the CitiWiki developers to use it.
Costal Martignier, developer of [[http://comawiki.org/CoMa.php?CoMa=StartSeite | CoMaWiki]], gave me express permission to use its code and release it with [[http://uniwakka.sourceforge.net | UniWakka]] under the BSD license.
Deletions:
I've just removed the code. This code derived from CitiWiki (with some modifications made by me), a WakkaWiki fork licensed under the BSD license. The TableOfContentsPseudoAction was originally developed by Costal Martignier for [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], which is release under a non-free license.
Since I used that code for [[http://uniwakka.sourceforge.net UniWakka]] I decided to contact Costal for information about its origin, and he told me he did not give permission to the CitiWiki developers to use it.
Costal Martignier, developer of [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], gave me express permission to use its code and release it with [[http://uniwakka.sourceforge.net UniWakka]] under the BSD license.


Revision [18409]

Edited on 2008-01-28 00:11:24 by FatherNitwit [Modified links pointing to docs server]

No Differences

Revision [8482]

Edited on 2005-05-25 22:20:19 by FatherNitwit [Modified links pointing to docs server]
Additions:
===Table of Contents===

I've just removed the code. This code derived from CitiWiki (with some modifications made by me), a WakkaWiki fork licensed under the BSD license. The TableOfContentsPseudoAction was originally developed by Costal Martignier for [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], which is release under a non-free license.
Since I used that code for [[http://uniwakka.sourceforge.net UniWakka]] I decided to contact Costal for information about its origin, and he told me he did not give permission to the CitiWiki developers to use it.

I'm ashamed, but I hope you'll understand I was in good faith.

Costal will probably give me permission to use it but I would suggest not to include it in any WakkaWiki fork until the issue has been totally clarified.

Sorry for the inconvenience.

Free software is incopatible with copyright violations.

--AndreaRossato - 2004-08-05

----

**Update**:
Costal Martignier, developer of [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], gave me express permission to use its code and release it with [[http://uniwakka.sourceforge.net UniWakka]] under the BSD license.

- So, where is the code for Wikka?

--AndreaRossato

----

Hello Andrea,
Thanks a lot for this code, it's quite a cool feature.
Just one point : there is a problem with the anchors under Mozilla. Indeed, as there is in your code no pages stated in URLs (just "#"), the links included in the TOC are like this : http://myhost/mywikipath/#2, and this doesn't works under Mozilla [FireFox, aso], as it brings you on the anchor #2 of the main page in "mywikipath". You have rather to create full links http://myhost/mywikipath/wikka.php?wakka=MyCurrentPage#2 (for example with the REQUEST_URI variable from HTTP_SERVER_VARS, that works fine)

--SergiO

----
You should remove the following line:
<base href="<?php echo $site_base ?>" />
from actions/header.php. This is causing the problem.

--AndreaRossato

----
If anybody cares, I have added my TOC addition here: SimpleTableOfContents
It should address the # issue without removing the base tag.
--FatherNitwit

----
Deletions:
===Table of Contents===

I've just removed the code. This code derived from CitiWiki (with some modifications made by me), a WakkaWiki fork licensed under the BSD license. The TableOfContentsPseudoAction was originally developed by Costal Martignier for [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], which is release under a non-free license.
Since I used that code for [[http://uniwakka.sourceforge.net UniWakka]] I decided to contact Costal for information about its origin, and he told me he did not give permission to the CitiWiki developers to use it.

I'm ashamed, but I hope you'll understand I was in good faith.

Costal will probably give me permission to use it but I would suggest not to include it in any WakkaWiki fork until the issue has been totally clarified.

Sorry for the inconvenience.

Free software is incopatible with copyright violations.

--AndreaRossato - 2004-08-05

----

**Update**:
Costal Martignier, developer of [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], gave me express permission to use its code and release it with [[http://uniwakka.sourceforge.net UniWakka]] under the BSD license.

- So, where is the code for Wikka?

--AndreaRossato

----

Hello Andrea,
Thanks a lot for this code, it's quite a cool feature.
Just one point : there is a problem with the anchors under Mozilla. Indeed, as there is in your code no pages stated in URLs (just "#"), the links included in the TOC are like this : http://myhost/mywikipath/#2, and this doesn't works under Mozilla [FireFox, aso], as it brings you on the anchor #2 of the main page in "mywikipath". You have rather to create full links http://myhost/mywikipath/wikka.php?wakka=MyCurrentPage#2 (for example with the REQUEST_URI variable from HTTP_SERVER_VARS, that works fine)

--SergiO

----
You should remove the following line:
<base href="<?php echo $site_base ?>" />
from actions/header.php. This is causing the problem.

--AndreaRossato

----


Revision [4775]

Edited on 2005-01-17 15:09:54 by NilsLindenberg [cat. changed]
Additions:
CategoryUserContributions
Deletions:
CategoryDevelopment


Revision [1997]

Edited on 2004-10-25 19:41:56 by NilsLindenberg [category added]
Additions:
CategoryDevelopment
Deletions:
--AndreaRossato


Revision [1606]

Edited on 2004-10-04 16:07:57 by DavidCollantes [Where is it for Wikka?]
Additions:
===Table of Contents===

I've just removed the code. This code derived from CitiWiki (with some modifications made by me), a WakkaWiki fork licensed under the BSD license. The TableOfContentsPseudoAction was originally developed by Costal Martignier for [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], which is release under a non-free license.
Since I used that code for [[http://uniwakka.sourceforge.net UniWakka]] I decided to contact Costal for information about its origin, and he told me he did not give permission to the CitiWiki developers to use it.

I'm ashamed, but I hope you'll understand I was in good faith.

Costal will probably give me permission to use it but I would suggest not to include it in any WakkaWiki fork until the issue has been totally clarified.

Sorry for the inconvenience.

Free software is incopatible with copyright violations.

--AndreaRossato - 2004-08-05

----

**Update**:
Costal Martignier, developer of [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], gave me express permission to use its code and release it with [[http://uniwakka.sourceforge.net UniWakka]] under the BSD license.

- So, where is the code for Wikka?

--AndreaRossato

----

Hello Andrea,
Thanks a lot for this code, it's quite a cool feature.
Just one point : there is a problem with the anchors under Mozilla. Indeed, as there is in your code no pages stated in URLs (just "#"), the links included in the TOC are like this : http://myhost/mywikipath/#2, and this doesn't works under Mozilla [FireFox, aso], as it brings you on the anchor #2 of the main page in "mywikipath". You have rather to create full links http://myhost/mywikipath/wikka.php?wakka=MyCurrentPage#2 (for example with the REQUEST_URI variable from HTTP_SERVER_VARS, that works fine)

--SergiO

----
You should remove the following line:
<base href="<?php echo $site_base ?>" />
from actions/header.php. This is causing the problem.

Deletions:
===Table of Contents===

I've just removed the code. This code derived from CitiWiki (with some modifications made by me), a WakkaWiki fork licensed under the BSD license. The TableOfContentsPseudoAction was originally developed by Costal Martignier for [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], which is release under a non-free license.
Since I used that code for [[http://uniwakka.sourceforge.net UniWakka]] I decided to contact Costal for information about its origin, and he told me he did not give permission to the CitiWiki developers to use it.

I'm ashamed, but I hope you'll understand I was in good faith.

Costal will probably give me permission to use it but I would suggest not to include it in any WakkaWiki fork until the issue has been totally clarified.

Sorry for the inconvenience.

Free software is incopatible with copyright violations.

--AndreaRossato - 2004-08-05

----

**Update**:
Costal Martignier, developer of [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], gave me express permission to use its code and release it with [[http://uniwakka.sourceforge.net UniWakka]] under the BSD license.


----

Hello Andrea,
Thanks a lot for this code, it's quite a cool feature.
Just one point : there is a problem with the anchors under Mozilla. Indeed, as there is in your code no pages stated in URLs (just "#"), the links included in the TOC are like this : http://myhost/mywikipath/#2, and this doesn't works under Mozilla [FireFox, aso], as it brings you on the anchor #2 of the main page in "mywikipath". You have rather to create full links http://myhost/mywikipath/wikka.php?wakka=MyCurrentPage#2 (for example with the REQUEST_URI variable from HTTP_SERVER_VARS, that works fine)

--SergiO

----
You should remove the following line:
<base href="<?php echo $site_base ?>" />
from actions/header.php. This is causing the problem.


Revision [953]

Edited on 2004-08-10 16:53:34 by AndreaRossato [Where is it for Wikka?]
Additions:
You should remove the following line:
<base href="<?php echo $site_base ?>" />
from actions/header.php. This is causing the problem.


Revision [952]

Edited on 2004-08-10 16:45:54 by SergiO [Where is it for Wikka?]
Additions:
Hello Andrea,
Thanks a lot for this code, it's quite a cool feature.
Just one point : there is a problem with the anchors under Mozilla. Indeed, as there is in your code no pages stated in URLs (just "#"), the links included in the TOC are like this : http://myhost/mywikipath/#2, and this doesn't works under Mozilla [FireFox, aso], as it brings you on the anchor #2 of the main page in "mywikipath". You have rather to create full links http://myhost/mywikipath/wikka.php?wakka=MyCurrentPage#2 (for example with the REQUEST_URI variable from HTTP_SERVER_VARS, that works fine)
--SergiO


Revision [909]

Edited on 2004-08-05 11:41:33 by AndreaRossato [update on copyright issue]
Additions:
----
**Update**:
Costal Martignier, developer of [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], gave me express permission to use its code and release it with [[http://uniwakka.sourceforge.net UniWakka]] under the BSD license.
--AndreaRossato


Revision [906]

Edited on 2004-08-05 09:57:31 by AndreaRossato [code removed for possible copyright infringement]
Additions:
I've just removed the code. This code derived from CitiWiki (with some modifications made by me), a WakkaWiki fork licensed under the BSD license. The TableOfContentsPseudoAction was originally developed by Costal Martignier for [[http://comawiki.org/CoMa.php?CoMa=StartSeite CoMaWiki]], which is release under a non-free license.
Since I used that code for [[http://uniwakka.sourceforge.net UniWakka]] I decided to contact Costal for information about its origin, and he told me he did not give permission to the CitiWiki developers to use it.
I'm ashamed, but I hope you'll understand I was in good faith.
Costal will probably give me permission to use it but I would suggest not to include it in any WakkaWiki fork until the issue has been totally clarified.
Sorry for the inconvenience.
Free software is incopatible with copyright violations.
--AndreaRossato - 2004-08-05
Deletions:
This patch against formatters/wakka.php will provide a table of contents pseudo action.
You also need to remove, from actions/header.php, this line:
<base href="<?php echo $site_base ?>" />
To use it insert in your page ""{{toc}}"" or ""{toc nr}}"" for a numbered toc.
You can also change the toc name (Index is the default):
""{{toc nr Table of Contents}}""
The biggest header ""======Header======"", to be used only for the page title, will not be included in the toc.
That's it.
Have fun.
--AndreaRossato
The code:
%%
--- wakka.php.orig 2004-05-29 13:20:24.000000000 +0000
+++ wakka.php 2004-07-28 13:51:19.000000000 +0000
@@ -121,36 +121,68 @@
if (preg_match("/^(.*)\.(gif|jpg|png)/si", $url)) return "<img src=\"$url\" />".$matches[2];
return $wakka->Link($url).$matches[2];
}
- // header level 5
- else if ($thing == "==")
- {
+ //headers with toc pseudo action
+ else if (preg_match("/^======(.*)======$/s", $thing, $matches))
+ {
$br = 0;
- return (++$trigger_l[5] % 2 ? "<h5>" : "</h5>\n");
- }
- // header level 4
- else if ($thing == "===")
- {
+ return "<h1>".str_replace("\n","<br />",htmlspecialchars($matches[1]))."</h1>";
+ }
+
+ else if (preg_match("/^=====(.*)=====$/s", $thing, $matches))
+ {
+ if ($_SESSION['tocnr'] == "yep")
+ {
+ $_SESSION["hr5"]++;
+ $_SESSION["hr4"] = 0;
+ $_SESSION["hr3"] = 0;
+ $_SESSION["hr2"] = 0;
+ $_SESSION["toccount"] = $_SESSION["hr5"].". ";
+ }
+ $_SESSION["headercount"]++;
+ $_SESSION['toc'] .= "<a style=\"padding-left:10px\" href=\"#titelanker".$_SESSION["headercount"]."\">".$_SESSION["toccount"].trim(htmlspecialchars($matches[1]))."</a><br />";
$br = 0;
- return (++$trigger_l[4] % 2 ? "<h4>" : "</h4>\n");
- }
- // header level 3
- else if ($thing == "====")
- {
+ return "<a id=\"titelanker".$_SESSION["headercount"]."\"></a><h2>".$_SESSION["toccount"].trim(htmlspecialchars($matches[1]))."</h2>";
+ }
+ else if (preg_match("/^====(.*)====$/s", $thing, $matches))
+ {
+ if ($_SESSION['tocnr'] == "yep")
+ {
+ $_SESSION["hr4"]++;
+ $_SESSION["hr3"] = 0;
+ $_SESSION["hr2"] = 0;
+ $_SESSION["toccount"] = (($_SESSION["hr5"]) ? $_SESSION["hr5"].". " : "").$_SESSION["hr4"].". ";
+
+ }
+ $_SESSION["headercount"]++;
+ $_SESSION['toc'] .= "<a style=\"padding-left:25px\" href=\"#titelanker".$_SESSION["headercount"]."\">".$_SESSION["toccount"].trim(htmlspecialchars($matches[1]))."</a><br />";
$br = 0;
- return (++$trigger_l[3] % 2 ? "<h3>" : "</h3>\n");
- }
- // header level 2
- else if ($thing == "=====")
- {
+ return "<a id=\"titelanker".$_SESSION["headercount"]."\"></a><h3>".$_SESSION["toccount"].trim(htmlspecialchars($matches[1]))."</h3>";
+ }
+ else if (preg_match("/^===(.*)===$/s", $thing, $matches))
+ {
+ if ($_SESSION['tocnr'] == "yep")
+ {
+ $_SESSION["hr3"]++;
+ $_SESSION["hr2"] = 0;
+ $_SESSION["toccount"] = (($_SESSION["hr5"]) ? $_SESSION["hr5"].". " : "").(($_SESSION["hr4"]) ? $_SESSION["hr4"].". " : "").$_SESSION["hr3"].". ";
+ }
+ $_SESSION["headercount"]++;
+ $_SESSION['toc'] .= "<a style=\"padding-left:40px\" href=\"#titelanker".$_SESSION["headercount"]."\">".$_SESSION["toccount"].trim(htmlspecialchars($matches[1]))."</a><br />";
$br = 0;
- return (++$trigger_l[2] % 2 ? "<h2>" : "</h2>\n");
- }
- // header level 1
- else if ($thing == "======")
- {
+ return "<a id=\"titelanker".$_SESSION["headercount"]."\"></a><h4>".$_SESSION["toccount"].trim(htmlspecialchars($matches[1]))."</h4>";
+ }
+ else if (preg_match("/^==(.*)==$/s", $thing, $matches))
+ {
+ if ($_SESSION['tocnr'] == "yep")
+ {
+ $_SESSION["hr2"]++;
+ $_SESSION["toccount"] = (($_SESSION["hr5"]) ? $_SESSION["hr5"].". " : "").(($_SESSION["hr4"]) ? $_SESSION["hr4"].". " : "").(($_SESSION["hr3"]) ? $_SESSION["hr3"].". " : "").$_SESSION["hr2"].". ";
+ }
+ $_SESSION["headercount"]++;
+ $_SESSION['toc'] .= "<a style=\"padding-left:55px\" href=\"#titelanker".$_SESSION["headercount"]."\">".$_SESSION["toccount"].trim(htmlspecialchars($matches[1]))."</a><br />";
$br = 0;
- return (++$trigger_l[1] % 2 ? "<h1>" : "</h1>\n");
- }
+ return "<a id=\"titelanker".$_SESSION["headercount"]."\"></a><h5>".$_SESSION["toccount"].trim(htmlspecialchars($matches[1]))."</h5>";
+ }
// forced line breaks
else if ($thing == "---")
{
@@ -319,6 +351,28 @@
$text = str_replace("\r", "", $text);
$text = chop($text)."\n";

+//pseudotocaction durch phantasiewort ersetzen, um es nachher wieder mit dem tocinhalt zu ersetzen
+if (preg_match("/{{toc nr ([A-Za-z0-9 ]*)}}/is", $text, $toctitle))
+ {
+ $text = preg_replace("/{{toc ([A-Za-z0-9 ]*)}}/", "{{toc nr}}", $text);
+ }
+else if (preg_match("/{{toc ([^nr][A-Za-z0-9 ]*)}}/is", $text, $toctitle))
+ {
+ $text = preg_replace("/{{toc ([^nr][A-Za-z0-9 ]*)}}/", "{{toc}}", $text);
+ }
+
+if ($toctitle[1] == "")
+ $toctitle[1] = "Index";
+
+
+if (strpos($text, "{toc nr}}"))
+ $_SESSION['tocnr'] = "yep";
+
+
+$text = preg_replace("/{{toc}}/", "tocactionplaceboding", $text);
+$text = preg_replace("/{{toc nr}}/", "tocactionplaceboding", $text);
+
+
$text = preg_replace_callback(
"/(\%\%.*?\%\%|".
"\"\".*?\"\"|".
@@ -326,7 +380,7 @@
"-{4,}|---|".
"\b[a-z]+:\/\/\S+|".
"\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|££|\+\+|__|<|>|\/\/|".
- "======|=====|====|===|==|".
+ "======.*?======|=====.*?=====|====.*?====|===.*?===|==.*?==|".
"\n([\t,~]+)(-|[0-9,a-z,A-Z]+\))?|".
"\{\{.*?\}\}|".
"\b[A-Z,ÄÖÜ][A-Z,a-z,ÄÖÜ,ßäöü]+[:]([A-Z,a-z,0-9,ÄÖÜ,ßäöü]*)\b|".
@@ -344,8 +398,18 @@
$replace3 = "\n";
$text=preg_replace($pattern3,$replace3,$text);

+$text = preg_replace("/tocactionplaceboding/", "<fieldset><legend> <b>".$toctitle[1]." </b></legend>".$_SESSION['toc']."</fieldset>", $text);
+
// we're cutting the last <br />
$text = preg_replace("/<br \/>$/","", trim($text));
echo ($text);
wakka2callback('closetags');
+$_SESSION['toc'] = "";
+$_SESSION['tocnr'] = "nope";
+$_SESSION["headercount"] = 0;
+$_SESSION["hr5"] = 0;
+$_SESSION["hr4"] = 0;
+$_SESSION["hr3"] = 0;
+$_SESSION["hr2"] = 0;
+$_SESSION["toccount"] = "";
?>
%%


Revision [793]

The oldest known version of this page was created on 2004-07-28 11:58:48 by AndreaRossato [code removed for possible copyright infringement]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki