getnikola / nikola Goto Github PK
View Code? Open in Web Editor NEWA static website and blog generator
Home Page: https://getnikola.com/
License: MIT License
A static website and blog generator
Home Page: https://getnikola.com/
License: MIT License
using it, the noAscii url will be convered to ASCII, that is nice.
Besides, It's usefull to create the meta file's filename.
eg.
if I write "中文abc" when "doit new_post", the meta file's filename and the post slug will be "abc.meta".
if I write "其他abc" when "doit new_post", the meta file's filename and the post slug will be "abc.meta" again!.
I have tried to patch it, but I didn't handle this. I just check the post slug is NULL or not, because I don't know how to use all languages that is noascii to test.
And is it possible add "unidecode" support again?
We should add to the README file the following dependences:
* PIL
* Pygments
You get "ERROR: render_site:all. Task dependency 'render_indexes' does not exist."
Some people may prefer to write pure HTML, so offer a way to do that. Should be trivial.
You get "ERROR: render_site:all. Task dependency 'render_galleries' does not exist."
it may be more pure but it feels like clutter to have 2 files for 1 post
How to use the "pages" title and link in base.tmpl?
Besides, I just can find the pages in "Archives" and "Tags"
Please create empty file nikola / data / themes / default / messages / ru.py so I'll be able to edit it from github interface - and I'll provide you with Russian translation.
Also if you give me some time I can translate Nikola main page and handbook. My jabber/email is [email protected].
Thank you for your work!
We need to check that we are generating valid RSS feeds. While PyRSS2gen seems to be pretty solid in my experience, a good look can't hurt, specially about character encodings.
Perhaps we can use feedparser as a validator.
Using Nikola from git. Here you have all the steps I did.
jose@manolito ~/desarrollo/nikola [master]$ git pull
Current branch master is up to date.
jose@manolito ~/desarrollo/nikola [master]$ pip install doit
Requirement already satisfied (use --upgrade to upgrade): doit in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): pyinotify in /usr/local/lib/python2.7/dist-packages (from doit)
Cleaning up...
jose@manolito ~/desarrollo/nikola [master]$ pip install --upgrade doit
Downloading/unpacking doit
Downloading doit-0.16.1.tar.gz (279Kb): 279Kb downloaded
Running setup.py egg_info for package doit
Downloading/unpacking pyinotify (from doit)
Downloading pyinotify-0.9.3.tar.gz (59Kb): 59Kb downloaded
Running setup.py egg_info for package pyinotify
Installing collected packages: doit, pyinotify
Found existing installation: doit 0.16.1
Uninstalling doit:
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 228, in run
requirement_set.install(install_options, global_options)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1089, in install
requirement.uninstall(auto_confirm=True)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 476, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1391, in remove
renames(path, new_path)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 248, in renames
shutil.move(old, new)
File "/usr/lib/python2.7/shutil.py", line 300, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/local/bin/doit'
Storing complete log in /home/jose/.pip/pip.log
jose@manolito ~/desarrollo/nikola [master*]$ sudo pip install --upgrade doit
Downloading/unpacking doit
Running setup.py egg_info for package doit
Downloading/unpacking pyinotify (from doit)
Running setup.py egg_info for package pyinotify
Installing collected packages: doit, pyinotify
Found existing installation: doit 0.16.1
Uninstalling doit:
Successfully uninstalled doit
Running setup.py install for doit
changing mode of build/scripts-2.7/doit from 644 to 755
changing mode of /usr/local/bin/doit to 755
Found existing installation: pyinotify 0.9.3
Uninstalling pyinotify:
Successfully uninstalled pyinotify
Running setup.py install for pyinotify
Successfully installed doit pyinotify
Cleaning up...
jose@manolito ~/desarrollo/nikola [master]$ nikola init jose.rebeldes.org.ar
Doing init
A new site with some sample data has been created at jose.rebeldes.org.ar.
See README.txt in that folder for more information.
jose@manolito ~/desarrollo/nikola [master_]$ cd jose.rebeldes.org.ar/
jose@manolito ~/desarrollo/nikola/jose.rebeldes.org.ar [master_]$ doit
Scanning posts . . done!
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/doit/doit_cmd.py", line 507, in cmd_main
return sub_cmd['run'](args_no_vars, sub=sub_cmd)
File "/usr/local/lib/python2.7/dist-packages/doit/cmdparse.py", line 262, in call
return self.do_cmd(params, args)
File "/usr/local/lib/python2.7/dist-packages/doit/doit_cmd.py", line 191, in cmd_run
dodo_tasks = loader.get_tasks(*_path_params(params))
File "/usr/local/lib/python2.7/dist-packages/doit/loader.py", line 248, in get_tasks
return load_dodo_file(dodo_module, command_names)
File "/usr/local/lib/python2.7/dist-packages/doit/loader.py", line 140, in load_dodo_file
task_list.extend(generate_tasks(name, ref(), ref.doc))
File "/usr/local/lib/python2.7/dist-packages/doit/loader.py", line 230, in generate_tasks
for task_dict, x_doc in flat_generator(gen_result, gen_doc):
File "/usr/local/lib/python2.7/dist-packages/doit/loader.py", line 37, in flat_generator
for value, value_doc in flat_generator(item, item_doc):
File "/usr/local/lib/python2.7/dist-packages/doit/loader.py", line 30, in flat_generator
for item in gen:
File "/usr/local/lib/python2.7/dist-packages/nikola/nikola.py", line 431, in gen_task_render_pages
lang, wildcard, template_name, destination):
File "/usr/local/lib/python2.7/dist-packages/nikola/nikola.py", line 395, in generic_page_renderer
deps = post.deps(lang) + self.template_deps(template_name)
File "/usr/local/lib/python2.7/dist-packages/nikola/mako_templates.py", line 49, in template_deps
dep_filenames = get_deps(template.filename)
File "/usr/local/lib/python2.7/dist-packages/nikola/mako_templates.py", line 14, in get_deps
text = util.read_file(filename)
The latest version of Nikola is 3.0.1 but in setup.py
the version is 3.1. Is it OK?
It needs a responsive no-more-than howevermany px thing.
I hate CSS.
(projects)[root@www02 nikola]# nikola init newblog
Doing init
A new site with some sample data has been created at newblog.
See README.txt in that folder for more information.
(projects)[root@www02 nikola]# cd newblog/
(projects)[root@www02 newblog]# doit
Scanning posts . . done!
ERROR: render_site:all. Task dependency 'render_listings' does not exist.
(projects)[root@www02 newblog]# ls
cache conf.py conf.pyc dodo.py dodo.pyc files galleries output posts README.txt stories
(projects)[root@www02 newblog]# doit new_post
Scanning posts . . done!
ERROR: render_site:all. Task dependency 'render_listings' does not exist.
Nikola needs tests. It's better to add them now that it's still relatively small ;-)
I find them distracting, useless, and ugly:
example.com/post.html vs. example.com/post
Just for fun or preview
When having Nikola running in i.e. /blog some links don't work, as they are pointing to /. instead
The tag in the post at the following link is pointing to /categories/... instead of /blog/categories/...
https://www.patrick-wildt.de/blog/posts/i.html
This happens, as _link() is calling path(), which is using the paths from conf.py to create (absolute) paths relative to output.
This means, it always creates absolute paths thinking, it's in /, which might be necessary when creating the render tasks.
I'd propose to either change the is_link case in path() or to change link() to have it add the actual root (i.e. /blog).
Currently, the rest/markdown compilers put their output alongside their inputs. This is not optimal:
Solution: create a cache folder and put these intermediate files there,
If you create two posts in the same folder with the same slug, so they are supposed to generate the same page, it will not fail.
Maybe as an option, maybe by default.
Sorry to say, but: did you ever have tried an installation from a plain python? You'll never get nikola running :-(
The first time I installed Nikola, I did some configuration, added a post, then removed 1.html, 1.meta, and 1.txt from {myblog}/posts. After doing this, running doit returns an error:
ERROR: render_site:all. Task dependency 'render_tags' does not exist.
I did the process again but this time did not touch the configuration, and only added a new post (no content/edits, just whatever doit new_post created), then removed the 1.* files. I received the same error.
This is with version 3.0.1
There is no point in using the full-size images for the "big" display.
Proposed solution:
Line 65 in nikola.py should be return dir_name
instead of return dirname
I need this for shoreham, so probably others need it too.
I found a little oddity when adding a post in the past year and then rebuilding the site.
Rebuild works fine, but when I navigate to the archives page it does not show the past year.
The same problem occurs with the tags overview.
How to reproduce:
I can generate the missing files when running doit forget followed by doit.
Currently, the entire site must be generated using the same compiler, either reST or markdown.
It would be better if pages/posts were compiled based on their type, this would allow us to decide to switch markup formats as we go, or—my use case—import things in markdown and then write in reST.
I can see three obvious ways to do this. In all of them I think that the right thing to do is to add the compiler as a property of the Post
class, through its __init__
, and then pass Post.compile_html
to doit instead of Nikola.compile_html
.
To specify mapping between files and compilers:
add an extra string to the post_pages
tuples (so that the format would become (wildcard, destination, template, use_in_feed, compiler)
, where compiler
is one of 'rest'
, 'markdown'
.
create a new top-level configuration key that has it, something like:
post_compile_types = {
"posts/*.txt": 'rest',
"posts/*.md": 'markdown',
"archives/*.txt": 'markdown'
}
Or, be less versatile and just do:
post_extension_types = {
"markdown": ['.md', '.markdown'],
"rest": ['.txt', '.rst', '.rest']
}
or the inverse:
post_extension_types = {
'.md': 'markdown',
# etc
}
(1) and (2) are essentially identical in terms of versatility. Technically (1) could get more verbose if you wanted to do lots of crazy things with post types, I think, but you would need to be really abusing things for that to be an issue.
(1) is slightly more invasive because every place that uses post_pages
needs to be adapted, but at the same time it's also got better locality: every pattern is guaranteed to be matched to the correct compiler.
(3) is both the least versatile and the least invasive. It does, however, match the way that most people use file extensions. Probably: I usually use *.rst for restructured text, and you seem to prefer *.txt, so I can imagine that there are people who would prefer to have the file extension separate from the filetype.
I think that I prefer (1), but if you have a preference I would be willing to do that instead.
nikola/data/samplesite/stories/manual.txt is a symbolic link?
If yes, I'm sorry.
Since the template engine is completely determined by the theme you are using, it should just be a setting provided by the theme.
The default use mode shouldn't be "copy the source code". It should probably work more like Hyde or Jekyll, where there is a tool to generate an initial site for you, and that site has nikola as an external dependency.
This would make it easier to update to new versions without having to merge the changes in.
First step towards the theme gallery + autodeployment of themes (how cool is that going to be? Very cool!)
Using the latest release of Nikola, I try to create a new post following the instructions of the Nikola Handbook but the new_post command seems not work correctly.
$ nikola init testsite
Doing init
A new site with some sample data has been created at testsite.
See README.txt in that folder for more information.
$ cd testsite/
$ nikola new_post
To create a new site in a folder, run "nikola init foldername [src]".
The destination folder must not exist.
If you pass the src argument, that folder will be used as a template for
the new site instead of Nikola's sample site.
And after that no file is created.
Hello, ralsina, I'm testing a nikola's theme:
http://k4y.me/en/posts/a-new-theme-for-nikola.html
try it:
doit install_theme -n owmx -u http://k4y.me/themes.json
Similar to what adduser does. This way a service or user could have a custom site template to start with.
I will need this for Shoreham.
Also, make sure we are shipping minimized js in the themes.
It should not try to figure out missing builds or anything, it should start immediately.
So, it should not happen for them. Example: serve
One annoying bug in Nikola is that when you use a relative link in a post, when the post is embedded in a RSS feed for a category the link will break (in some cases, also in the main feed).
This is because RSS readers try to resolve relative links as relative to the URL of the feed, and really, they should be relative to the URL of the root of the blog.
A solution for this may be to use the xml:base attribute of the feed as described in http://cyber.law.harvard.edu/rss/relativeURI.html
However, I am using PyRSS2Gen (http://www.dalkescientific.com/Python/PyRSS2Gen.html) to generate the feeds.
I am severely allergic to XML, so if anyone else could take a long hard look at this bug and fix it, I will be very grateful!
I hope I can add "prevlink" and "nextlink" into post.tmpl , but I don't known how to do that
I have added "2.md" and "2.meta" in "posts" diretory, then run "doit", but it don't create a html.
is it wrong that I did?
That means that when you relocate the output, links to translated pages, for example, are wrong.
Looks like a missing config dependency
When trying to run parallel builds, there is an error:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/queues.py", line 266, in _feed
send(obj)
PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed
Currently, if you delete a post, or change a setting that moves files around, the old generated files will stay in place, which can be embarrasing.
Nikola should offer a way to detect stale files and allow for their removal.
So if story.tmpl inherits base.tmpl, all pages rendered using story.tmpl should be re-rendered when base.tmpl changes.
I asked in the Mako mailing list:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.