Skip to content

Commit

Permalink
Updating to put back in support for raw message docs for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Eitan Marder-Eppstein committed Feb 1, 2013
1 parent 2d68653 commit 1ee1fe2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/rosdoc_lite/msgenator.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ def index_type_link(pref, type_, base_package):
else:
return _href("../../%(package)s/html/%(pref)s/%(base_type_)s.html" % locals(), type_)

def _generate_raw_text(spec):
raw_text = spec.text
s = ''
for line in raw_text.split('\n'):
line = line.replace(' ', ' ')
parts = line.split('#')
if len(parts) > 1:
s = s + parts[0]+'<font color="blue">#%s</font><br/>'%('#'.join(parts[1:]))
else:
s = s + "%s<br/>"%parts[0]
return s

def _generate_msg_text_from_spec(package, spec, msg_context, buff=None, indent=0):
if buff is None:
Expand Down Expand Up @@ -135,6 +146,7 @@ def generate_srv_doc(srv, msg_context, msg_template, path):
'date': str(time.strftime('%a, %d %b %Y %H:%M:%S'))}
spec = genmsg.msg_loader.load_srv_from_file(msg_context, path, "%s/%s" % (package, base_type))
d['fancy_text'] = _generate_srv_text(package, base_type, msg_context, spec)
d['raw_text'] = _generate_raw_text(spec)
return msg_template % d


Expand All @@ -145,6 +157,7 @@ def generate_msg_doc(msg, msg_context, msg_template, path):
'date': str(time.strftime('%a, %d %b %Y %H:%M:%S'))}
spec = genmsg.msg_loader.load_msg_from_file(msg_context, path, "%s/%s" % (package, base_type))
d['fancy_text'] = _generate_msg_text(package, base_type, msg_context, spec)
d['raw_text'] = _generate_raw_text(spec)
return msg_template % d


Expand Down
6 changes: 4 additions & 2 deletions src/rosdoc_lite/templates/msg-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ a:hover {
}
.fancy-msg {
width: auto;
font-size: 14px;
line-height: 16px;
border: 1px solid #333;
padding: 10px;
margin-bottom: 20px;
Expand All @@ -39,8 +41,8 @@ a:hover {
.raw-msg {
font-family: monospace;
width: auto;
font-size: 12px;
line-height: 12px;
font-size: 14px;
line-height: 16px;
padding: 5px;
border: 1px solid #333;
margin-bottom: 20px;
Expand Down
6 changes: 5 additions & 1 deletion src/rosdoc_lite/templates/msg.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@

<h2>File: <span class="filename">%(name)s.%(ext)s</filename></h2>

<h2>Message Definition</h2>
<h2>Raw Message Definition</h2>
<div class="raw-msg">
%(raw_text)s
</div>

<h2>Compact Message Definition</h2>
<div class="fancy-msg">
%(fancy_text)s
</div>
Expand Down

0 comments on commit 1ee1fe2

Please sign in to comment.