Giter Site home page Giter Site logo

getnikola / nikola Goto Github PK

View Code? Open in Web Editor NEW
2.5K 78.0 443.0 38.57 MB

A static website and blog generator

Home Page: https://getnikola.com/

License: MIT License

Python 96.30% CSS 2.52% JavaScript 0.15% Shell 0.70% XSLT 0.26% HTML 0.03% Jupyter Notebook 0.04%
python static-site-generator static-site

nikola's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nikola's Issues

request to add "unidecode" support again

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?

2 Dependences

We should add to the README file the following dependences:

* PIL
* Pygments

Russian translation

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!

Do RSS feed validation.

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.

doit fail

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)

AttributeError: 'module' object has no attribute 'read_file'

is it a bug?

(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.

There are no tests

Nikola needs tests. It's better to add them now that it's still relatively small ;-)

_link() creates absolute path without considering not being in /

Issue

When having Nikola running in i.e. /blog some links don't work, as they are pointing to /. instead

Example

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

Cause

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.

Proposal

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).

Don't pollute the input folders.

Currently, the rest/markdown compilers put their output alongside their inputs. This is not optimal:

  1. It makes doing a html "compiler" harder than needed
  2. It just adds cruft
  3. Makes versioning inputs slightly harder

Solution: create a cache folder and put these intermediate files there,

Documentation and functionality

Sorry to say, but: did you ever have tried an installation from a plain python? You'll never get nikola running :-(

  • Missing dependencies, e.g. unidecode.
  • Sample not working: e.g: calling doit from within the samplesite results in an error: ERROR: Task render_site must yield dictionaries

Deleting the samplesite 1.* files from a fresh install causes a doit crash

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

Make galleries more efficient

There is no point in using the full-size images for the "big" display.

Proposed solution:

  1. Generate "large" thumbnails to be used for that
  2. Add links to the original-size image in the gallery index.

Archive/tags page gets not build

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:

  • init an empty Nikola instance
  • build the example site via doit
  • copy the example post and name the files 2.*
  • change the year in 2.meta to 2011 (instead of 2012)
  • rebuild the site via doit
  • serve the files
  • navigate to the archive (http://localhost:8000/archive.html)
  • see only the year 2012

I can generate the missing files when running doit forget followed by doit.

Post should be compiled based on the file type

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:

  1. 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'.

  2. create a new top-level configuration key that has it, something like:

    post_compile_types = {
        "posts/*.txt": 'rest',
        "posts/*.md": 'markdown',
        "archives/*.txt": 'markdown'
    }
    
  3. 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.

should be usable as a library

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.

Is new_post command broken?

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.

Relative links in feeds break

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!

How to add a ".md" post?

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?

Can't parallelize builds

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

Should report on non-generated files in output

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.