Closed alex179ohm closed 11 years ago
This is nice patch. I like all those new features. Though, I'd like to know, on the basis of what have to selected the set of languages for output formattiing ? Or did you just provided some, to be extended later on ?
Best regards, Roland.
Extend the language output formatting is very simple,you just have to edit the LANGS and LANG_CMT dicts in core.py:
LANG_CMT = {"comment_name":[u'string', u'string', u'string'], }
is the dict that contains the comment types
key: is the name of the comment type value: is a len 3 list of strings, the first string is the string which open a multiline comment, the second string is the string which comment every line of the license and the last string is the the string which close a multiline comment.
LANGS = {"string":"string", }
is the dict that associate lang to comment type key: is the name of the language and the suffix of the source file value: is the name of the comment type associated
Example:
LANGS = {"py":"unix", "c":"c"}
LANG_CMT = {"unix":{u'', u'#', u''}, "c":[u'/*', u'*', u'*/']}
NOTE: unicode (u) after the comment strings is required to avoid problem with StringIO() (used for perfomance and unicode porting problems)
If you want add a cpp source file format and language, you just have to add
"cpp":"c"
to LANGS (c comment type already exist in LANG_CMT)
now I write a few lines of doc in core.py and I drop you a pull_request....
Regards, Alex.
Fixed tests
( works on python 2.7, 3.3)