Skip to content

Commit

Permalink
put get_title in it's place
Browse files Browse the repository at this point in the history
  • Loading branch information
espeed committed Mar 9, 2012
1 parent 54cf2cd commit a2f6122
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
12 changes: 10 additions & 2 deletions lightbulb/command.py
Expand Up @@ -8,11 +8,12 @@
import datetime
import subprocess
import argparse
from titlecase import titlecase

from config import Config, Path
from setup import setup, generate_bulbsconf
from engine import Parser, Writer, Loader
from utils import get_template, get_working_dir, get_title
from utils import get_template, get_working_dir


# Valid commands: setup, new, edit, init, build, update, bulbsconf
Expand Down Expand Up @@ -96,10 +97,17 @@ def _get_params(self, filename):
docid = uuid.uuid4().hex
date = datetime.datetime.now().strftime("%Y-%m-%d")
username = self.config.username or getpass.getuser()
title = get_title(filename, self.config)
title = self._get_title(filename)
params = dict(title=title, docid=docid, author=username, date=date)
return params

def _get_title(self, filename):
stub = os.path.splitext(filename)[0]
word_list = stub.split(self.config.separator)
words = " ".join(word_list)
title = titlecase(words)
return title

def _write_file(self, file_path, content):
with open(file_path, "w") as fout:
fout.write(content.encode('utf-8') + '\n')
Expand Down
11 changes: 0 additions & 11 deletions lightbulb/utils.py
Expand Up @@ -7,7 +7,6 @@
import sys
from string import Template
from subprocess import Popen, PIPE
from titlecase import titlecase

from model import cache

Expand Down Expand Up @@ -51,13 +50,3 @@ def validate_git_repo(dirname):
sys.exit(1)


#
# Text Processing
#

def get_title(filename, config):
stub = os.path.splitext(filename)[0]
word_list = stub.split(config.separator)
words = " ".join(word_list)
title = titlecase(words)
return title

0 comments on commit a2f6122

Please sign in to comment.