Commits

Sepehr Taghdisian  committed e83dde1

updated README, added $(logo) variable

  • Participants
  • Parent commits b062cd3
  • Branches 1.2

Comments (0)

Files changed (4)

 - Creates identical directory tree for HTML files 
 - Themes with JSON config files
 
+### Windows binaries
+For windows users who doesn't want to bother with python, You can download latest stand-alone binaries from  
+[here](https://bitbucket.org/sepul/pymdwiki/downloads).
+
 ### Installation
-Requirements :
+You just have to install these requirements to be able to run from source:
   
 - *Python 2.7*: Install Python binaries for your OS. ([link](http://python.org/download/))
 - *Markdown for python*: Follow the instructions [here](http://pythonhosted.org/Markdown/install.html) for installing this package for python.
 
-Clone the source (or download .zip version), extract it somewhere on your disk, and type:  
+### Usage
+Download binaries or the source and:
 ```
+cd /path/to/pymdwiki/src
 python mdwiki.py --help
 ```
 to see command line options.  
-For stand-alone distribution (like windows), typing the executable is sufficient:  
+For stand-alone distribution, typing the executable is sufficient:  
 ```
+cd path/to/mdwiki
 mdwiki --help
 ```
 
-#### Windows binaries
-You can download stand-alone windows binaries from this 
-[link](https://bitbucket.org/sepul/pymdwiki/downloads).
- 
-### Usage
-Command line options: 
+#### Command line options
 
 - *--input [inputdir]*: Sets input root directory which *mdwiki* searches for (.md) files recursively. Default path is the current directory.
 - *--output [outputdir]*: Sets output root directory which *mdwiki* writes HTML files, directories will be created exactly like the input directories (if they contain .md files). Default path is *./html*
 - *--verbose*: Enable verbose messages
 
 ### Themes
-Themes are references by their _names_ which is basically their directory names under _themes_ directory. For example one of the bundled themes are _darkhammer_, which is the directory with the same name under _path/to/pymdwiki/themes_ directory.  
+Themes are referenced by their _names_ which is basically their directory names under _themes_ directory. For example one of the bundled themes are _darkhammer_, which is a directory with the same name under _path/to/pymdwiki/themes_.  
 
 #### Making new themes
 To create themes you should create a directory under _themes_ directory and put these files into it:
     - **$(PREFIX)**: Prefix path should come before any resource files for the theme
     - **$(TITLE)**: Title of the wiki
     - **$(FOOTNOTE)**: User footnote for the footer
+    - **$(LOGO)**: Can be a relative path to an image for the wiki 
 
 - **config.json**: This is settings JSON file for the theme, includes common variables for theme compiler. _mdwiki_ will read this file and fillup some template tags:  
     - **title**: will set _$(TITLE)_ value upon HTML generation (see above)
     - **footnote**: will set _$(FOOTNOTE)_
+    - **logo**: will set _$(LOGO)_
 
-**Note** that the engine only reads all _(png, jpg, css, js, gif)_ files under theme directory (not recursive) and copy them to HTML directory or upload them to ftp, so don't bloat the root directory for the theme with unnecessary files.
+**Note** that the program only reads all _(png, jpg, css, js, gif)_ files under theme root path (not recursive) and copy them to ouput HTML path or upload them to ftp, so don't bloat the main directory for the theme with unnecessary files.
 
 ### License
 License for source code and redistribution is [BSD 2-Clause](http://opensource.org/licenses/BSD-2-Clause)

File src/mdwiki.py

         print 'Warning: invalid theme (impl.html does not exist), loading default theme'
         return prepare_default_theme(title)
     
-    html = re.sub('(?:\$\()(TITLE)(?:\))', jcfg['title'], html)
-    html = re.sub('(?:\$\()(FOOTNOTE)(?:\))', jcfg['footnote'], html)
+    # apply some json variables into the HTML code
+    html = re.sub('(?:\$\()(TITLE)(?:\))', jcfg['title'] if jcfg['title'] else '', html)
+    html = re.sub('(?:\$\()(FOOTNOTE)(?:\))', jcfg['footnote'] if jcfg['footnote'] else '', html)
     html = re.sub('(?:\$\()(THEMEPATH)(?:\))', themedir_rel.replace('\\', '/'), html)
+    html = re.sub('(?:\$\()(LOGO)(?:\))', jcfg['logo'] if jcfg['logo'] else '', html)
     
     # copy and enumerate files
     files = glob.glob(themedir + '/*.css')

File src/themes/darkhammer/config.json

 {
     "title": "darkHAMMER wiki",
-    "footnote": "Copyright (c) 2013 - Sepehr Taghdisian (www.hmrengine.com)"
+    "footnote": "Copyright (c) 2013 - Sepehr Taghdisian (www.hmrengine.com)",
+    "logo": "logo.png"
 }

File src/themes/darkhammer/tmpl.html

             <header class='header'>
             <br>
             <div class='logo center'>
-                <img src='$(PREFIX)$(THEMEPATH)/logo.png'/>
+                <img src='$(PREFIX)$(THEMEPATH)/$(LOGO)'/>
                 <text class='sidebar-title'>$(TITLE)</text>
             </div>
             <hr>