That thought occurred to me also... But then I got to wondering around
at the pros/cons of automatically inserting anchors in headers. Every
header? When, when not?
Then you also have the problems of what to name the anchors. Anchors
can only be certain strings with no spaces, so what do I do with:
!! Some Header
You could output options like these:
!! [[#Some_Header]] Some Header
!! [[#someheader]] Some Header
!! [[#h1]] Some Header
We could even set up some kind notation based on the level of header:
! Text => ! [[#h1_1]] Text
!! Text => ! [[#h2_1]] Text
!!! Text => ! [[#h3_1]] Text
etc
This would make it possible to create a complete outline in your
sumbox. That would be pretty cool.
The hard part about developing weeks is not the coding. All this is
quite easy. It's deciding on what we want the wiki to do.
Also, I suspect something like this should probably be reserved for a plugin.
Hmmmm... Can't resist a good challenge... This was trickier than I
thought. The problem is the sumbox function scans the page source. So
just inserting an anchor in the headers output won't help us when we
are looking for anchors in the sumbox function. The trick is to
somehow coordinate the markup and the function. Here, try this in
your config file. Just use "!! Some Text" for your headers, then put
[(sumbox)] at the top of the page. This will make a good plugin...
function BOLTFsumbox($args) {
global $pageLink;
if (isset($args['page'])) $page = $args['page'];
else $page = $pageLink;
$zone = 'main';
$content = BOLTloadpage($page);
preg_match_all('/\!\! (.*)/m', $content, $matches);
foreach ($matches[1] as $i => $ii) {
$count = $i + 1;
$out .= "$count [[$page#$zone$count|" . $matches[1][$i] .
"]]<br>";
}
return "<div class='sumbox'>$out</div>";
}
MarkUp('fmt', 'headers', '/(^|>)(!{1,6})(.*)/me',
'BOLTManchorheaders("$2", "$3", "$1", "$zone")');
function BOLTManchorheaders($headers, $label, $start, $zone) {
if ($zone == 'main') {
global $BOLTanchorheaders;
$BOLTanchorheaders[$zone] = $BOLTanchorheaders[$zone] + 1;
$label = "<a name='$zone$BOLTanchorheaders[$zone]'>$label</a>";
}
return BOLTMheaders($headers, $label, $start);
}
Then in your style sheet define the sumbox class to whatever you want.
For starters, just copy the .box class to .sumbox. Let me know if you
don't know how to do this.
If anyone has further feature requests for this plugin, let me know!
Cheers,
Dan
On Fri, Dec 19, 2008 at 10:20 AM, Daisuke <[email protected]> wrote:
>
> Thanks ill try this out.
> But personally i think it would be cooler if boltwire can generate
> "contents box" automatically without having to type eg) !! [[#head1]]
> Header
> As a wiki user, having to type lesser codes/tags is an important
> factor.
>
> D
>
> On Dec 20, 3:40 am, "The Editor" <[email protected]> wrote:
>> On Fri, Dec 19, 2008 at 5:15 AM, Daisuke <[email protected]> wrote:
>>
>> > Thank you!
>> > Is there any way to have the topics in the contents to link to its own
>> > topics? Cureently there are just plain texts.
>>
>> Currently the script is just looking for headers, like
>>
>> !! header
>>
>> To get it to link to the header, you have to put anchors in them:
>>
>> !! [[#head1]]Header
>>
>> In which case we would could change the sumbox function to only look
>> for anchors and then link to them. Try this:
>>
>> function BOLTFsumbox($args) {
>> global $pageLink;
>> if (isset($args['page'])) $page = $args['page'];
>> else $page = $pageLink;
>> $content = BOLTloadpage($page);
>> preg_match_all('/\[\[\#(.*)\]\](.*)/m', $content, $matches);
>> foreach ($matches[1] as $i => $ii) {
>> $count = $count + 1;
>> $out .= "$count [[$page#$ii|" . $matches[2][$i] . "]]<br>";
>> }
>> return "<box>\n$out\n</box>";
>> }
>>
>> Hey this is starting to look like a real plugin. Anyone care to post
>> it in the solutions area? Maybe someone with some time could even
>> consider tapping this into the template engine... That way we could
>> completely customize the output on the fly. Kind of getting cool, eh?
>>
>> Cheers,
>> Dan
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---