Harsh as it might sound, the documentation is outdated and does not address the problem on how to write a .LRN Portlet.
Some general hints though:
You have three different packages. The application package where you should store the content that is being displayed in the portal in an include in the /lib directory. Look at project-manager/lib/tasks on how this is done.
The application-portlet package provides a wrapper for the include file in the /lib directory. It knows with which values to call the include and sets up specific portal information. Look at /project-manager-portlet/www/project-manager-tasks-portlet how this is done.
The dotlrn-application package integrates the portlet into .LRN. There is some magic involved (which I did not bother to understand) and the Applet shows up as the installable applets in your community.
In general there are two working modes for a portlet. One within a community where you should limit the display of content in the include to items that have the package_id of the mounted package within the community. And the mode where you display it in "My Space" where you will only limit the items displayed by the ones a user has permission to read.
The code I refer to lies in HEAD, hope this get's you started.