Comments (5)
I tried to do this in the past. It was very painful, but perhaps I didn't approach the problem correctly. What you really want is a way to have several traversal passes just like Scribble.
from pollen-users.
You could approximate a multi-pass render with two ingredients:
-
a link index that gathers the links from all the pages and emits them in some convenient format (XML, JSON, S-expression, etc.) When you regenerate the whole project, you would generate this link index first. After that, when you update individual page files, you could incrementally update the link index.
-
if you wanted the backlinks, say, in the bottom of each page, you would add a function to your
template.html.p
that reads the links for a certain page from the link index and inserts them.
from pollen-users.
Further to this multi-pass approach, consider how a Pollen document gets rendered:
- Pollen “runs” your document as code which produces its
doc
andmetas
values. - The
doc
andmetas
get handed to a template, which has its own code for inserting those values into the rendered file.
One way you can get things to run somewhat faster is if each document does its own updates to the “link index” (I like to use a SQLite database file) during step 1. Then use code that runs during step 2 to collect information back out of the link index and insert it at the point the template is rendered.
You also have to think about dependencies a lot harder now. You edit some files and add a bunch of links into them. How do you ensure that all the linked-to pages get re-rendered properly with all the correct backlink information? You could just remember which links you added and re-render those pages manually. Or you could just rebuild the entire site every time you add links. Or you could use a makefile to describe a dependency tree and then, as part of your ‘link’ function (i.e., during step 1) do a touch
of the file that is the target of the link (example), updating its timestamp and causing make
to re-render the page.
Or, you could write a web server in Racket that provides an API for retrieving info from your link index, and update the backlinks dynamically with JavaScript on the client end. Boom, no more having to think about dependencies and build steps, all the cross-referency bits gets handled dynamically just like in a database-backed CMS. But all that complexity is conserved: now you have to think up front about how to provide and consume this API.
from pollen-users.
@tlcu Please let me know if you solve this. I'm looking at Roam myself, as I need some sort of "graph-of-knowledge" notetaking tool, too. It would be cool to have it all in Pollen. How do you plan to handle the links themselves? Will you do any sort of UID, similar to how its done in the typical Zettelkasten method?
from pollen-users.
@tlcu Please let me know if you solve this. I'm looking at Roam myself, as I need some sort of "graph-of-knowledge" notetaking tool, too. It would be cool to have it all in Pollen. How do you plan to handle the links themselves? Will you do any sort of UID, similar to how its done in the typical Zettelkasten method?
@Eugleo I will certainly keep you informed. I plan on clearing out my work for this week and seeing what I can do over the weekend. At this point I am weighing adapting an existing solution (like Ikiwiki) against a from-scratch implementation. I of course agree that the knowledge base in Pollen and Racket would be very cool! I've created a repository here, where everything and everything is up for discussion (including the name :) ): https://github.com/tlcu/rome-research
I imagine that every link will be associated with a unique identifier, but I am happy to hear more so feel free to create an issue in the new repo. I have heard of Zettelkasten but am not overly familiar with its inner workings, feel free also to educate me.
I sincerely appreciate the remarks of everyone above, and will update this thread if I can find a neat solution.
from pollen-users.
Related Issues (20)
- render index.ptree with subdirectories changes directory (though not project root) HOT 8
- Is parallel mode known to crash a lot? HOT 1
- decode-elements with decode-paragraphs inserts spurious <p> when nesting lists? HOT 2
- multiple text arguments? HOT 5
- serialising txexprs? HOT 2
- Beautiful Racket Racket docs HOT 1
- Classic tangle/weave support a la org/babel-mode HOT 2
- Add source tag to default block-tags HOT 3
- Importing text from other sources HOT 2
- One source file → multiple outputs of same type? HOT 6
- Having a hard time with maps HOT 4
- Metadata on pagenodes (?) / how to render link traversal HOT 5
- Filling templates multiple times, à la mail-merge -- maybe a non-use case? HOT 3
- Inserting html comment with pollen command HOT 4
- splitf-txexpr: how to use the resulting txexpr HOT 2
- Windows: Set Pollen environment variable HOT 2
- execute shell command via preprocessor?
- Mildy Dynamic Websites
- opinions sought: costs & benefits of switching to self-hosted Git server? HOT 17
- Could not find MANIFEST for package source HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pollen-users.