Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-07-07 14:26:00

vid
New Member
Registered: 2008-07-07
Posts: 5

[textile] Multiple footnotes at same place

I want to have multiple footnotes after some claim, like this:

Many people argue it is true[11][12][13]
...
fn11. Johny, How I discovered this is true
fn12. Billy, I feel it is true
fn13. W, God told Me it is true]

But here, footnotes in text display without any break:

Many people argue it is true111213

If I place space between footnotes, it doesn’t display correctly:

Many people argue it is true11 [12] [13]

I think textpattern could automatically insert space or comma between consectutive footnotes, so that true111213 would appear as three separate footnotes

Offline

#2 2008-07-07 15:14:08

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Multiple footnotes at same place

Doesn’t this belong to the Textile area, ‘cause we are speaking about the Textile Markup, not actually “Textpattern”.

But to fix this, you can allways style things. In example:

sup.footnote {
	margin: 0 2px;
}

Offline

#3 2008-07-07 15:44:38

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [textile] Multiple footnotes at same place

The alternative would be a patch such as this one:

--- classTextile.php	(revision 2917)
+++ classTextile.php	(working copy)
@@ -998,17 +998,24 @@
 // -------------------------------------------------------------
 	function footnoteRef($text)
 	{
-		return preg_replace('/(?<=\S)\[([0-9]+)\](\s)?/Ue',
-			'$this->footnoteID(\'\1\',\'\2\')', $text);
+		return preg_replace('/(?<=\S)((?:\[[0-9]+\])+)(\s)?/e',
+			'$this->footnoteID(\'\1\')', $text);
 	}

 // -------------------------------------------------------------
-	function footnoteID($id, $t)
+	function footnoteID($id)
 	{
-		if (empty($this->fn[$id]))
-			$this->fn[$id] = uniqid(rand());
-		$fnid = $this->fn[$id];
-		return '<sup class="footnote"><a href="#fn'.$fnid.'">'.$id.'</a></sup>'.$t;
+		$ids = explode('][', trim($id, ']['));
+		$out = '';
+
+		foreach ($ids as $id)
+		{
+			if (empty($this->fn[$id]))
+				$this->fn[$id] = uniqid(rand());
+			$fnid = $this->fn[$id];
+			$out[] = '<sup class="footnote"><a href="#fn'.$fnid.'">'.$id.'</a></sup>';
+		}
+		return join(' ', $out);
 	}

 // -------------------------------------------------------------

I prefer the CSS solution. Wish I’d thought of that before creating the patch ;)

Offline

#4 2008-07-07 17:17:10

vid
New Member
Registered: 2008-07-07
Posts: 5

Re: [textile] Multiple footnotes at same place

Thanks, the CSS solution is very elegant. I think it could help other people with same problem in future, if it was included in default installation.

Offline

Board footer

Powered by FluxBB