That is good stuff, Eric.  Thanks!

If you don't mind me standing on your shoulders for a moment:

If one prefers the one tiddler to handle it all (well, 
TiddlyWiki.com/static and Wikipedia, others at your discretion) ...

\define AddTiddlyWikiTopic( topic )
<option value={{{ [[$topic$]split[ 
]join[%2520]addprefix[https://tiddlywiki.com/static/]addsuffix[.html]] 
}}}>$topic$</option>
\end

\define AddWikipediaTopic( topic )
<option value={{{ 
[[$topic$]encodeuri[]addprefix[https://en.wikipedia.org/wiki/]] 
}}}>$topic$</option>
\end

<$select tiddler={{Docs!!title}} field="curr-topic">
<optgroup label="TiddlyWiki">
<<AddTiddlyWikiTopic  "Custom styles by data-tiddler-title">>
<<AddTiddlyWikiTopic  "Widgets">>
<<AddTiddlyWikiTopic  "Filter Operators">>
</optgroup>
<optgroup label="Wikipedia">
<<AddWikipediaTopic  "TiddlyWiki">>
<<AddWikipediaTopic  "WikiWikiWeb">>
<<AddWikipediaTopic  "Project Xanadu">>
</optgroup>
</$select>&nbsp;&nbsp;<a href={{Docs!!curr-topic}} title="Open web page in 
a separate window/tab"  target="_blank">link</a>
<iframe  src={{Docs!!curr-topic}} height="500" width="100%"></iframe>


On Saturday, April 24, 2021 at 9:30:04 AM UTC-3 Eric Shulman wrote:

> On Saturday, April 24, 2021 at 3:16:22 AM UTC-7 ludwa6 wrote:
>
>> PS to my last: have fixed part of the problem: by adding the suffix 
>> clause back into macro (as below), it now pulls not a system-level error 
>> msg, but the error msg from wikipedia.org site itself, which seems to be 
>> objecting to the .html extension only... yet i can't find a way to remove 
>> that w/o reverting to the lower-level error msg.  Any insight about this 
>> problem would be appreciated!
>
>
> Try this in a tiddler named "ShowWikipediaFrame":
> \define AddTopic(topic) <option value={{{ [[$topic$]encodeuri[]addprefix[
> https://en.wikipedia.org/wiki/]] }}}>$topic$</option>
>
> <$select field="curr-topic">
> <<AddTopic  "TiddlyWiki">>
> <<AddTopic  "WikiWikiWeb">>
> <<AddTopic  "Project Xanadu">>
> </$select>&nbsp;&nbsp;<a href={{!!curr-topic}} title="Open web page in a 
> separate window/tab"  target="_blank">link</a>
> <iframe src={{!!curr-topic}} height="500" width="100%"></iframe>
>
> Notes:
> * The filter  in AddTopic  needed a closing "]]".  Also, the filter uses 
> "encodeuri[]" rather than "split[ ]join[%2520]".  This handles all special 
> URI characters, not just space.
> * The target tiddler for storing the $select widget value is the *current 
> tiddler*, rather than "Wikipedia" (or {{Wikipedia!!title}}) and the 
> corresponding <a href=...> and <iframe src=...> params simply fetch 
> {{!!curr-topic}} (i.e., from the current tiddler).  This allows you 
> transclude the above content as a template (e.g., {{||ShowWikipediaFrame}}) 
> and each transcluded instance can be used to show a different selected 
> topic.
>
> enjoy,
> -e 
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7fde4cd7-0518-4319-970c-59ef9eac42a7n%40googlegroups.com.

Reply via email to