SmartBlocks icon indicating copy to clipboard operation
SmartBlocks copied to clipboard

Wikipedia SmartBlock

Open mlava opened this issue 4 years ago • 10 comments

✂️ Copy of your #42SmartBlock from Roam

Download the zip, extract the json and import into your Roam Research graph. Wikipedia SB 0.5.zip

📋 Describe the SmartBlock

This SmartBlock obtains the page title and then searches Wikipedia for results. It then presents a series of buttons for you to select the right results. The SB then obtains the extract and primary image for that Wikipedia page and displays them in your RR page. The sentence length of the extract is configurable. CSS is provided and this needs to be copied into your roam/css page.

✅ Describe any prerequisites or dependencies that are required for this SmartBlock

Roam42. Nil other, no API token required. Provided CSS to be copied into roam/css page.

📷 Screenshot of your #42SmartBlock workflow/template from Roam

screencapture-roamresearch-2021-01-21-19_51_11

💡 Additional Info

screenshot 12

mlava avatar Jan 21 '21 08:01 mlava

This is great. One element I miss is a link back to the Wikipedia page as often I'm keen to look up more.

kmaustral avatar Jan 23 '21 02:01 kmaustral

👍👍

lxyntz avatar Jan 23 '21 13:01 lxyntz

@kmaustral

That is a very good idea. See updated zip file in first post.

This version also offers the option to define the search mode.

Page Title will automatically search for the page title on Wikipedia as before.

Prompt will trigger a pop-up that you can type your search query into.

Cheers!

mlava avatar Jan 24 '21 00:01 mlava

That works well Mark. Without being too picky, when you're doing the next version, maybe populate the dialogue with the page title on the "Prompt" setting. Often the page names need just a little tweak, like removing "Zettel/" to work. Much appreciated, mate.

kmaustral avatar Jan 24 '21 03:01 kmaustral

Thanks, @kmaustral.

Updated version in the first post which includes your excellent suggestion.

Thanks!

mlava avatar Jan 24 '21 09:01 mlava

Great.

kmaustral avatar Jan 24 '21 10:01 kmaustral

Updated version in the first post. Fixes a script crash if there is no hero image available for download.

mlava avatar Feb 05 '21 04:02 mlava

Hi, mlava! Thanks for your SB: it really helps me in my research work (until now I used the "iref" thing into my pages...).

May I suggest to add a "Select Wikipedia language" option in a future release? It would greatly help, as I often find myself in the need to search in IT, FR and/or EN Wikipedia.

Thanks again for your work!

Hileotech avatar Mar 26 '21 14:03 Hileotech

Great extension, thanks!

To make the menu of search results clickable straight away, I added these lines to the bottom of the main Wikipedia SB:

await roam42.common.sleep(500);
await roam42KeyboardLib.pressEsc(200);

pjjh avatar Apr 05 '21 16:04 pjjh

New version in first post.

Updated to:

  • use roam.alpha write API
  • fix some bugs
  • make menu clickable without needing to click away first

mlava avatar Apr 26 '21 22:04 mlava