Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for _and_newer and _and_older suffixes in Version macro #127

Merged
merged 1 commit into from
May 6, 2015

Conversation

wjwwood
Copy link
Contributor

@wjwwood wjwwood commented May 5, 2015

Previously you had to explicitly state for each block which ROS distro's were applicable, but now you can do something like this:

<<Version()>>

{{{#!wiki version fuerte_and_older
This is fuerte and older
}}}

{{{#!wiki version groovy
This is groovy
}}}

{{{#!wiki version hydro_and_newer
This is hydro and newer
}}}

Fixes: #110

@wjwwood
Copy link
Contributor Author

wjwwood commented May 5, 2015

@dirk-thomas @trainman419 @tfoote @esteve for review.

@wjwwood
Copy link
Contributor Author

wjwwood commented May 5, 2015

If merged, I will update this page: http://wiki.ros.org/WikiMacros#Version

@esteve
Copy link
Contributor

esteve commented May 5, 2015

+1

@trainman419
Copy link

+1 . The API and the documentation looks great. I don't really understand the moinmoin macro system, so I don't feel qualified to review the implementation.

@wjwwood
Copy link
Contributor Author

wjwwood commented May 5, 2015

One note, I couldn't use my first choice of rosdistro+ and rosdistro-, because the former isn't a valid css class name.

@@ -36,16 +55,40 @@ def execute(macro, args):
'New in %s</span>' % version)

def distro_html(distro, distros):
active = [distro.encode("iso-8859-1")]
inactive = [x.encode("iso-8859-1") for x in distros if not x == distro]
html = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be remove this line and assign it in line 80? Makes the variable have much smaller scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it changes the scope; I had that there for debugging by adding more stuff to the html in the loop. I'll move it, but I don't see that it matters.

@wjwwood
Copy link
Contributor Author

wjwwood commented May 5, 2015

Comments addressed, @tfoote can you spare a second to review this. I'd like to start using it on the wiki asap.

assert(distro in distros)
distro_index = sorted_distros.index(distro)
preceding_distros.extend(sorted_distros[:distro_index])
proceeding_distros.extend(sorted_distros[distro_index:][1:])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not remove line 58 and 59 and replace 64 and 65 with the following?

preceding_distros = sorted_distros[:distro_index + 1]
proceeding_distros = sorted_distros[distro_index:]

@tfoote
Copy link
Member

tfoote commented May 5, 2015

lgtm

@wjwwood
Copy link
Contributor Author

wjwwood commented May 5, 2015

Thanks, @esteve can you merge and deploy?

esteve added a commit that referenced this pull request May 6, 2015
Added support for _and_newer and _and_older suffixes in Version macro
@esteve esteve merged commit 7c92ccc into master May 6, 2015
@esteve esteve deleted the issue_110 branch May 6, 2015 00:30
wjwwood added a commit that referenced this pull request May 6, 2015
esteve added a commit that referenced this pull request May 6, 2015
fixes the $ROS_DISTRO js based "macro" after #127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide version fallback for versioned pages
5 participants