Skip to content

Markdown for plugin descriptions - #1142

Merged
peternewman merged 46 commits into
OpenLightingProject:masterfrom
FloEdelmann:plugins-md
Jan 6, 2017
Merged

Markdown for plugin descriptions#1142
peternewman merged 46 commits into
OpenLightingProject:masterfrom
FloEdelmann:plugins-md

Conversation

@FloEdelmann

Copy link
Copy Markdown
Member

I started progress to close #678 and project 1.

The plugin descriptions are converted to Markdown (README.md in each directory). I've also written a shell script to convert those Markdown files into C++ header files which can be called automatically during build. I don't know how to integrate that into the automake toolchain, so I leave this open for you ;)

You can tell me how to start and I'll try to do it myself.

@peternewman peternewman added this to the 0.11.0 milestone Oct 23, 2016
@peternewman peternewman self-assigned this Oct 23, 2016
@peternewman

Copy link
Copy Markdown
Member

Here's an example of integrating a generated script into our Makefiles:
https://github.com/OpenLightingProject/ola/blob/master/include/ola/Makefile.mk#L46

@peternewman

Copy link
Copy Markdown
Member

Thanks, BTW, this is a pleasant surprise. :)

@peternewman peternewman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few other bits that will need doing, some of which I'm sure you're aware of:

  • Switch the C++ code to use the new descriptions and remove the old ones.
  • Potentially reformat the plugin help so it fits within the 80 char line limit when it's in a string.
  • Add the new README.mds (and the script) to the relevant Makefile.mk's

Comment thread plugins/usbdmx/README.md
@@ -1,5 +1,37 @@
USBDMX Plugin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you split the dev info out into a readme developer file of some sort please, as we don't need it to appear in the UI for the users.

It probably makes sense to standardise plugins/osc/README in the same way at the same time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/convert_README_to_header.sh Outdated
identifier="PLUGINS_${plugin}_DESCRIPTION_H_";
identifier=`echo "$identifier" | tr '[:lower:]' '[:upper:]'`

echo "#ifndef $identifier" > $outfile;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You'll need to add an appropriate header with licenses too. See https://github.com/OpenLightingProject/ola/blob/master/include/ola/make_plugin_id.sh for an example.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/convert_README_to_header.sh Outdated

plugin=`basename "$path"`

desc=`sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\\\\\\\n"\n"/g' "$path/README.md"`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's an impressive number of backspace escapes!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, but it works 😀

@peternewman

Copy link
Copy Markdown
Member

Given there are a number of plugins here, it probably makes sense to go through the review cycle with just one initially, then when we're happy you can apply the reviewed change style to all the other plugins, rather than repeatedly changing everything each time until it's sorted.

* call convert_README_to_header.sh from automake tools
* use plugin_description in Karate plugin
@FloEdelmann

Copy link
Copy Markdown
Member Author

See Karate plugin for how I did it. If that suits your needs, it's easy to add it for the other plugins, too.

* fix osc Makefile
* fix line length
* rename ifndef variable
@FloEdelmann

FloEdelmann commented Oct 25, 2016

Copy link
Copy Markdown
Member Author

Unfortunately, it doesn't work on Travis :(
I included the rule that matches all plugin description header files in plugins/Makefile.mk and that worked for me at home. Now Travis says it can't find a rule for target include/ola/plugins/karate_plugin_desc.h. Any idea why or how to make it better?

EDIT: The linter task has generated it. Now I'm completely confused.

Comment thread plugins/Makefile.mk Outdated
include plugins/uartdmx/Makefile.mk
endif

include/ola/plugins/%_plugin_desc.h: plugins/%/README.md plugins/convert_README_to_header.sh plugins/Makefile.mk

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd just stick it in the relevant plugin folder, so presumably plugins/%/%_plugin_desc.h, rather than putting it in include; we've got plenty of other headers in those folders already.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

double %s don't work unfortunately. Should I rather go for plugins/%/PluginDescription.h?

Comment thread plugins/karate/Makefile.mk Outdated
endif

EXTRA_DIST += plugins/karate/README.protocol
EXTRA_DIST += plugins/karate/README.md \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We generally just go for += \ on the first line, then list everything indented beneath as you've done below.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/karate/Makefile.mk Outdated
BUILT_SOURCES += include/ola/plugins/karate_plugin_desc.h
lib_LTLIBRARIES += plugins/karate/libolakarate.la
plugins_karate_libolakarate_la_SOURCES = \
include/ola/plugins/karate_plugin_desc.h \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you fix the indenting please.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

@FloEdelmann

FloEdelmann commented Oct 26, 2016

Copy link
Copy Markdown
Member Author

Travis is still failing, but only on Mac OS / XCode. The compiler complains Expected ';' after top level declarator. It could be this issue: http://stackoverflow.com/questions/12160733/xcode-doesnt-recognize-the-word-class

So I'll try making it a .cpp file instead of a .h header.

@peternewman

Copy link
Copy Markdown
Member

My suspicion is your sed command isn't working correctly on the Mac, see this line you've got '0.1\n"n"==='; where it should be multiple lines or something:
2190const char plugin_description[] = "KarateLight - Version 0.1\n"n"=========================\n"n"\n"n"The plugin creates devices with a single output port. Info on the\n"n"KarateLight Hardware can be found at http://karatelight.de\n"n"\n"n"Unfortunately the site is in German only, but the maintainer will respond to\n"n"emails in English.\n"n"\n"n"\n"n"## Config file: ola-karate.conf\n"n"\n"n"device = /dev/kldmx0 \n"n"The path to the KarateLight device. Multiple entries are supported.";

You could try changing travis-ci.sh to cat out the file you're having issues with in the after_failure section.

According to http://stackoverflow.com/a/16576291, \n is not recognized on
Mac OS as a newline character, but \[actual newline] works.
Let's try it out :)
This reverts commit 2a51b74.

@peternewman peternewman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly just minor nits. I personally don't like convert_README_to_header.sh as a filename, particularly the mixed case, but that's entirely irrational and down to me, and I can't think of a legitimate reason to change it!

Have you tested that the output still looks okay via ola_plugin_info and the old web UI?

Comment thread plugins/artnet/README.md Outdated
| 1 | 15 | 0 | 496 |
| 1 | 15 | 15 | 511 |

That is `Port Address = (Net << 8) + (Subnet << 4) + (Universe % 4)`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be % 16 at the end.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/dummy/README.md Outdated
* Sensor Device, with a number of sensors implemented
* Network Device, with E1.37-2 PIDs

The number of each device is configurable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changing number to quantity would probably make it more readable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or "The number of each type of device is configurable."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/e131/README.md Outdated
The number of input ports to create up to a max of 32.

`ip = [a.b.c.d|<interface_name>]`
The ip address or interface name to bind to. If not specified it will use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SPaG IP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/espnet/README.md Outdated
## Config file: `ola-espnet.conf`

`ip = [a.b.c.d|<interface_name>]`
The ip address or interface name to bind to. If not specified it will use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Again IP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/artnet/Makefile.mk Outdated
# The OLA artnet plugin
lib_LTLIBRARIES += plugins/artnet/libolaartnet.la
plugins_artnet_libolaartnet_la_SOURCES = \
plugins/artnet/ArtNetPluginDescription.h \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we put this below ArtNetPlugin.h please.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/osc/README.developer Outdated
@@ -1,3 +1,6 @@
OSC Plugin Developer Information

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is the file Markdown, or just something that looks similar? If the former, can we give it a .md extension.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It was just something similar but I transformed it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Top marks for effort!

Comment thread plugins/pathport/README.md Outdated
Set the DSCP value for the packets. Range is 0-63.

`ip = [a.b.c.d|<interface_name>]`
The ip address or interface name to bind to. If not specified it will use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/sandnet/README.md Outdated
## Config file: `ola-sandnet.conf`

`ip = [a.b.c.d|<interface_name>]`
The ip address or interface name to bind to. If not specified it will use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/shownet/README.md Outdated
## Config file: `ola-shownet.conf`

`ip = [a.b.c.d|<interface_name>]`
The ip address or interface name to bind to. If not specified it will use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

Comment thread plugins/stageprofi/Makefile.mk Outdated
endif

EXTRA_DIST += plugins/stageprofi/README.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we remove the blank line please.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done

@peternewman

Copy link
Copy Markdown
Member

@nomis52 can you review the changes. @daveol can you take a look at the JS changes please.

I'm tempted to say we merge this as is, when the outstanding nits are fixed. Then get @FloEdelmann to do the other plugins promptly afterwards and merge them in a second PR to keep the diff sizes down. As long as he checks that no-one has updated plugin descriptions in the meantime (which seems unlikely aside from #1147 , then we should be fine).

open as you step through the explanations.

Let's get to it. If you make it all the way through this doc and I ever meet
you in person I'll buy you a beer!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok I already made it through the doc 😆

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Heh, you need to talk to @nomis52 for that, and fly to the states! Or I'll buy you one if I see you in the UK.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Those are both a bit far away for me unfortunately...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well if you ever end up over either way...

@FloEdelmann

FloEdelmann commented Dec 4, 2016

Copy link
Copy Markdown
Member Author

The output for the old web UI / ola_plugin_info actually also improved for my taste.

@peternewman

Copy link
Copy Markdown
Member

Excellent. As long as they look readable don't have formatting quirks and the line breaks etc still work, that's fine.

peternewman
peternewman previously approved these changes Dec 6, 2016
@peternewman peternewman removed their assignment Dec 7, 2016

@peternewman peternewman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@peternewman
peternewman requested a review from nomis52 December 20, 2016 00:16
@peternewman

Copy link
Copy Markdown
Member

@nomis52 I'm happy with this, do you want to give it a once over too please?

@FloEdelmann

FloEdelmann commented Jan 5, 2017

Copy link
Copy Markdown
Member Author

Still no update?

As soon as this is merged, I'll update the other plugins to let them also use their README files in the C++ code.

@nomis52 nomis52 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My only comment is that I would have called these CONFIG.md.

Other than that it looks fine.

@peternewman

Copy link
Copy Markdown
Member

Thanks @nomis52 . I think the benefit of them being README.md is that it partially self-documents on GitHub, as you get the introduction to each plugin in it's plugin folder, like so:
https://github.com/FloEdelmann/ola/tree/82a753fec37362d61f6c340e87f67cdd1e248f9d/plugins/artnet

I'm going to force merge this, so you can get working on the other plugins @FloEdelmann , as the test failure is related to some Travis changes I made the other day rather than your code.

@peternewman
peternewman merged commit 7d25bbd into OpenLightingProject:master Jan 6, 2017
@FloEdelmann
FloEdelmann deleted the plugins-md branch January 6, 2017 17:17
@FloEdelmann
FloEdelmann restored the plugins-md branch January 6, 2017 18:05
@FloEdelmann
FloEdelmann deleted the plugins-md branch January 6, 2017 18:08
@peternewman peternewman mentioned this pull request Jul 12, 2026
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.

Switch to markdown in all the Plugin info strings

4 participants