DEV Community

Shaily Shah
Shaily Shah

Posted on

LAB -3 Adding new Features to the Tool.

The script for converting text and Markdown files to HTML in the 'til' tool has been enhanced to include additional features. Firstly, the code now supports an optional language flag (-l or --lang) that indicates the language for the generated HTML documents. For instance, specifying -l fr sets the language to French, resulting in <html lang="fr">. The default language is Canadian English (en-CA). The changes ensure the proper generation of the lang attribute on the root <html> element.

Additionally, the script now adheres to better coding practices by incorporating exit codes. The program exits with a code of 0 upon successful completion and a non-zero exit code (e.g., 1) in case of errors. This allows for more robust error handling and better integration into automated processes.

Furthermore, a minor issue with the Markdown-to-HTML conversion function has been fixed. The function now properly handles the lang parameter and distinguishes between Markdown and plain text content, providing appropriate rendering for each.

These updates improve the overall functionality, usability, and reliability of the 'til' tool, making it more versatile and user-friendly. Users can easily specify the language and rely on consistent exit codes for error handling in various scenarios.

Top comments (0)