Logs for #nikola for 2022-12-16

04:20:08 <LohanG> Hello, I have a nikola blog published on my server. It was inactive for a while and I have lost access to its source files. Is it possible to recreate them from the published website? Alternatively, what is the recommended way to continue blogging to the same site, without recreating everything manually?
04:22:09 <LohanG> I can live with not having access to my markdown content from before, if there is a way to continue to publish to the same blog/site.  The urgent need is to resume publishing.
04:22:52 <LohanG> ^ recovering/receating old markdown content is a matter of secondary importance 
06:50:21 <ndim> Is it possible to have both a ShortcodePlugin plugin and a Task plugin with the same name?
06:52:53 <ndim> Disclaimer: I am not a Nikola expert in any way, but I have had my own statically generate website since about 1999.
06:53:36 <ndim> I have found Nikola sometimes copies the *.md files to the output/ dir, so those files might actually have ended up on the server after all.
06:55:36 <ndim> Otherwise, it might be a stopgap measure to create a new nikola instance and author there, and then have a shell script generate a synthesis between the output/ from the new site and the output/ from the old site.
06:56:18 <ndim> Things like indexes etc would not contain links to the old stuff for the time being, but at least the old posts would still be available (without links to the new stuff).
06:56:26 <ndim> Ugly, but maybe better than nothing.
06:56:56 <ndim> You sure you don't have a copy of the git repo with the old source files anywhere?
06:58:27 <ndim> Extracting the text content from the posts from the published website's HTML files as HTML and storing that as *.html files instead of *.md might be possible as well, but you still need to extract any metadata for that.
07:12:36 <ndim> Hmm. Let me rephrase my above question: Is it possible to have a plugin/foo.{plugin,py} which contains two classes, one of which derives from ShortcodePlugin and the other from Task?
07:15:12 <ndim> I want to have the ShortcodePlugin record which parameter it is called with (there might be several calls with the same parameter) and produce a <img src="..."> element, and then have the Task generate doit tasks which produce one image file per parameter to fit the <img src="..."> src URL.
07:15:29 <ndim> I am running into all kind of weird issues.
09:44:40 <LohanG> ndim: Not being a programmer, I was not familiar with Git when I migrated my blog to nikola few years ago. I switched because nikola is static; I could host it anywhere :) I do have a backup, far away from where I am right now. I should have kept a copy somewhere online, or on the server itself.
09:46:37 <LohanG> Thanks for the helpful pointers!
09:54:23 <LohanG> I should probably start syncing it vie nextcloud to keep a real-time copy online, so this will not happen next time
13:38:22 <ndim> LohanG: Have you checked whether your published website contains the *.md files?
14:00:09 <LohanG> yes ndim , I checked. It has html files only.
14:01:45 <ndim> OK, sorry. Then I am holding my fingers crossed for you, hoping someone competent will read about your problem and have an idea.
15:25:00 <LohanG> no worries, ndim  :) 
17:06:16 <ChrisWarrick> LohanG: Recreating the posts from HTML (in HTML format) would be doable, but it would require some work to extract the post content from the output files (HTML or possibly RSS). I don’t think there’s an easy solution for this.
17:06:38 <ChrisWarrick> LohanG: There is no way to “continue” a site without having its source or a recreation of it.
17:27:05 <ChrisWarrick> ndim: shortcode plugins generating tasks aren’t really doable, because doit doesn’t allow new tasks to appear during task execution. You could work around it with a latetask and some hackery, or consider making the shortcode and tasks parts completely independent
17:28:40 <ndim> Or create the image files as a side effect of the shortcode.
17:29:10 <ChrisWarrick> certainly possible, but I wouldn’t recommend it
17:29:18 <ndim> Hmm... no. Then the image files will not be considered properly created.
17:29:28 <ndim> (within the task framework)
17:31:34 <ndim> I could write a Task which goes through site.timeline looking for a post with a certain metadata item set, and then parse that one post looking for the shortcode and generating the tasks which write the image files.
17:33:51 <ChrisWarrick> what are the image files and how are they related to posts?
17:34:33 <ndim> The hypercube images in https://n-dimensional.de/cubes/ or the fractal images in https://n-dimensional.de/fractals/
17:37:00 <ChrisWarrick> a task plugin that looks through site.timeline sounds like something that could work
17:38:20 <ChrisWarrick> the pkgindex plugins do something like this
23:47:55 <LohanG> Thanks ChrisWarrick , I understand.