Repository: getnikola/nikola

Issue:
nikola auto behavior
nikola auto - automatically execute tasks when a dependency changes

It might be rather a question or something that need to be clarify, I would have expected auto to rebuild if there is also changes in stories or in conf.py

What is the desired behavior ?



Discussion:
`nikola auto` will trigger a rebuild when an existing file dependency change is detected.

This includes:

1) Edition of an existing post/story
2) Edition of an existing template or asset in the current theme or its parent themes (when appropiate)
3) Edition of an existing file in files/

And not much else.

It would be possible to replace the current auto command with one that watches more stuff (for example, post creation), if anyone volunteers.

I am thinking in watchdog to do this kind of stuff... I will investigate in this direction...

On 06/08/13 19:22, Damián Avila wrote:

> I am thinking in watchdog to do this kind of stuff... I will
> investigate in this direction...
> 
> It should be trivial to do using inotifywait

Thanks for the clarification, I was sure that earlier the story wasn't getting updated but now it works like a charm :/

Thanks!

> It should be trivial to do using inotifywait

I will see on this too... thanks.


Resolving patch:
diff --git a/nikola/post.py b/nikola/post.py
--- a/nikola/post.py
+++ b/nikola/post.py
@@ -304,7 +304,7 @@ def _translated_file_path(self, lang):
         else:
             return '.'.join((self.base_path, sorted(self.translated_to)[0]))
 
-    def text(self, lang=None, teaser_only=False, strip_html=False):
+    def text(self, lang=None, teaser_only=False, strip_html=False, really_absolute=False):
         """Read the post file for that language and return its contents.
 
         teaser_only=True breaks at the teaser marker and returns only the teaser.
@@ -328,7 +328,8 @@ def text(self, lang=None, teaser_only=False, strip_html=False):
                 return ""
             # let other errors raise
             raise(e)
-        document.make_links_absolute(self.permalink(lang=lang))
+        base_url = self.permalink(lang=lang, absolute=really_absolute)
+        document.make_links_absolute(base_url)
         data = lxml.html.tostring(document, encoding='unicode')
         # data here is a full HTML doc, including HTML and BODY tags
         # which is not ideal (Issue #464)
@@ -345,10 +346,11 @@ def text(self, lang=None, teaser_only=False, strip_html=False):
             if teaser != data:
                 if TEASER_REGEXP.search(data).groups()[-1]:
                     teaser += '<p class="more"><a href="{0}">{1}</a></p>'.format(
-                        self.permalink(lang), TEASER_REGEXP.search(data).groups()[-1])
+                        self.permalink(lang, absolute=really_absolute),
+                        TEASER_REGEXP.search(data).groups()[-1])
                 else:
                     teaser += READ_MORE_LINK.format(
-                        link=self.permalink(lang),
+                        link=self.permalink(lang, absolute=really_absolute),
                         read_more=self.messages[lang]["Read more"])
                 # This closes all open tags and sanitizes the broken HTML
                 document = lxml.html.fromstring(teaser)
diff --git a/nikola/utils.py b/nikola/utils.py
--- a/nikola/utils.py
+++ b/nikola/utils.py
@@ -275,7 +275,7 @@ def generic_rss_renderer(lang, title, link, description, timeline, output_path,
         args = {
             'title': post.title(lang),
             'link': post.permalink(lang, absolute=True),
-            'description': post.text(lang, teaser_only=rss_teasers),
+            'description': post.text(lang, teaser_only=rss_teasers, really_absolute=True),
             'guid': post.permalink(lang, absolute=True),
             # PyRSS2Gen's pubDate is GMT time.
             'pubDate': (post.date if post.date.tzinfo is None else


Test patch: