Skip to content

Autogenerating Website from Code Comments: A Proposal Sketch #5

@tajmone

Description

@tajmone

Hi @SicroAtGit, I have a proposal: I would like to write an app that can generate the required HTML pages to create a website for PureBasic-CodeArchiv-Rebirth (via GitHub Pages project's website). I would take care of all the coding, so it won't burden you any further, and when it's ready — and if you like it — you could then merge it in.

Here is a general sketch of what I have in mind, and I'd like to create a system that doesn't add a burder in the project maintainance, but actually slims it down.

HTML Files and Website Structure

  • Set GitHub Pages to publish from master branch, so that the actual webpages are HTML files inside the repo, alongside with the code files.
  • Have single index.html per folder, containing auto-generated resume cards for all the source files inside that folder (and navigation links).
  • Have a single assets folder in the root, for CSS stylesheets and other shared assets, to prevent pollution of the project with lots of unrelated files.

Contents from Source Comments

The app should generated a resume card for each souce code file or project, by parsing the comments in the file. There would be very little changes (if any) to comments as they are now: the app's parser should be smart to detect what is what by looking for "<key>: <value>" structures. At the most, for special cases like multiline verbatim blocks (as in a license text), a single unobstrusive character might be added after the comment delimiter in order to allow the parser to know if that comment line is significant. For example:

;| The pipe after ";" could be a non-intrusive special char for the parser.
;{| Between the comment delimiter and the special char there might be a space
; | or one of the special PB comments chars "{ } -", so that code folding and
; | indexing might be preserved.
;}
;@ Different chars can be used to tell the parser what is what.

Special needs could be handled by machine generated comments at the end of the file.

Because of the "<key>: <value>" structure, the current comments system is already simple to parse, and intuitive to use for coders who want to add some code :

;   Description: Threadsafe FIFO-BufferQueue
;            OS: Mac, Windows, Linux
; English-Forum: 
;  French-Forum: 
;  German-Forum: http://www.purebasic.fr/german/viewtopic.php?f=8&t=27824
; -----------------------------------------------------------------------------

Oviously, the new system will impose strict rules on the entries structure and naming convention, but this is inline with the project's goals anyhow.

The system should be simple enough that contributors can handle it from within PB IDE, but it would be good to provide a dedicated IDE tool for validating the comments (check that all required keys are present, and that their format is correct).

The HTML Generator App

The app for generating the resume cards and HTML pages will be written in PureBASIC (I can reuse code I've written for the PB Archives CMS I'm working on). If needed, it might rely on some external tools, like pandoc for format conversion — possibly, standalone binary tools only. But I believe that the required HTML will be simple enough to handle it from PB code.

The app could be hosted inside the assets folder, along with sytlesheet and images, to avoid creating more folders. So, we won't be needing separate developers branches: everything needed to generate the HTML pages will be kept in the repo's master branch, without polluting it.

Keep in mind that, beside adding an online website to the PureBasic-CodeArchiv-Rebirth project, this will also make it browsable locally, and simplify the user experience of navigating through its contents.

Furthermore, the same data extracted from the comments and used to build the website pages could also be used (in the future) to build a database of the project's contents. We could then create a UI app that enables to quickly search and browse the project's contents using criterias such as OS compatiblity, categories, dependencies, tags, etc. So there is actually more potential in this idea then just a website.

Now, if you think the ideas is worth a try, I shall be working on it locally, and when a usable prototype is ready for testing I could create a testing ground repository so we can fine tune it.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions