[library-web] [htmlfiles] get document title from index <title> tag



commit 65474b431833cb3c11cb58b56c8c1c1cdb8da999
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat Aug 8 18:14:50 2009 +0200

    [htmlfiles] get document title from index <title> tag

 src/modtypes/htmlfiles.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/modtypes/htmlfiles.py b/src/modtypes/htmlfiles.py
index 581ba5f..fa21fd3 100644
--- a/src/modtypes/htmlfiles.py
+++ b/src/modtypes/htmlfiles.py
@@ -18,6 +18,7 @@
 
 import logging
 import os
+import re
 import shutil
 import stat
 import subprocess
@@ -144,5 +145,10 @@ class HtmlFilesModule(DocModule):
                 os.unlink(path)
             os.symlink(self.index_filename, path)
 
+        title = re.findall('<title>(.*)</title>',
+                file(os.path.join(web_output_dir, 'index.html')).read())
+        if title:
+            doc.title = {'C': title[0]}
+
         self.install_version_symlinks(doc)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]