My latest contribution to Blockpress has been to add support for steem post content. To demonstrate this I added, as seen in the highlighted code segment in the above screenshot, a link to the menu of my original steem introduce yourself post, Ahoy There!.

See it in action

Blockpress doesn't yet have permalink support(*), so you will have to visit anton.blockpress.me and then click Ahoy There from the menu. Blockpress then uses steem-js to get the markdown for this post from the steem blockchain. To parse this into html I added support for the showdown javascript library to blockpress.

Blockpress then includes the content on the page. Support for other post related fields, such as title, author, post date, votes, etc, and an option to display comments will be added, but for now just the main content displays.

(*) it is on my agenda, I just haven't gotten around to it yet.

My commit in github

All my changes to implement this basic post feature can be found in one commit on github.

Changes in the commit include

External libraries used, such as steem-js and showdown , are now kept separate from modules in a special lib folder. The jquery library should probably be moved to fit this new pattern. This means that if another module needs steem-js or showdown libraries, they won't rely on the steem module being installed, or have to duplicate the libraries.

and , are now kept separate from modules in a special folder. The library should probably be moved to fit this new pattern. This means that if another module needs steem-js or showdown libraries, they won't rely on the module being installed, or have to duplicate the libraries. I created the default steem post html template. This defines areas for content not yet supported, but which we plan to support. An individual theme may altar this layout by including a file of the same name. The code will look for a version in the current theme first and only load the default if one can't be found.

Most of the work was in modules\steem\steem.js . This involved adding the functions that are activated when a steem post link is activated. These get the template, use the steem api to get the post content, put the template in the contentArea , parse the mardown into html, and put the resulting post into the relevant section of the page. It will be here that additional information from the steem post object will be used to add information about the author, title and postdate.

. This involved adding the functions that are activated when a steem post link is activated. These get the template, use the steem api to get the post content, put the template in the , parse the mardown into html, and put the resulting post into the relevant section of the page. It will be here that additional information from the steem post object will be used to add information about the author, title and postdate. I also made some basic adjustments to the default dark style to accommodate the new type of content. I expect @dana-varahi will tidy this up further later.

Where next?

Whilst @dana-varahi extends the profile and post fields supported, I will concentrate next on creating a list of posts given a username and/or tag. Once I have these three steem content types supported I will then be able to create links between them. Click on a post in a list of posts and bring up the post content. Click on a username in a post or post list and go to a profile. Click on a tag in a profile about or a post and go to the post list for that tag.

Once we can link between these kinds of content, that will be when blockpress becomes really exciting...





Posted on Utopian.io - Rewarding Open Source Contributors