Skip to content

Commit

Permalink
merge second feature branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mingming-ma committed Sep 30, 2023
2 parents 627a890 + 0418e18 commit 3fab6c9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
- [x] User specified output path (version 0.1.1)
- [x] Set title from input file content (version 0.1.2)
- [x] Support Markdown file input and Italics Parsing (version 0.1.3)
- [x] Support language attribute configuration (version 0.1.3)

- [x] Add support for Markdown horizontal rule (`---`) to convert that to an `<hr>` tag. Support language attribute configuration (version 0.1.4)
## How to Install

**In command line:**
Expand Down
3 changes: 2 additions & 1 deletion examples/test-folder-output/test3.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ <h1>This is title</h1><p></p>
<p>This is the <i>first</i> paragraph. </p>
<p></p>
<p>This is the <i>second</i> paragraph. </p>

<p></p>
<hr>
</body>
</html>
4 changes: 3 additions & 1 deletion examples/test-folder/test3.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ This is title

This is the *first* paragraph.

This is the _second_ paragraph.
This is the _second_ paragraph.

---
16 changes: 12 additions & 4 deletions txt2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ def process_text_file(input_file, output_folder):

#Check if input_file is Markdown (.md)
if (input_file.endswith(".md")):
# Process updatedLine with addition Markdown conversion logic
updatedLine = process_line(updatedLine)
if (updatedLine.__eq__("---")):
bodyParagraph += "<hr>"
continue
else:
# Process updatedLine with addition Markdown conversion logic
updatedLine = process_line(updatedLine)

bodyParagraph += f"<p lang=\"{lang_attribute_value}\">" + updatedLine + "</p>\n"

Expand All @@ -108,8 +112,12 @@ def process_text_file(input_file, output_folder):

#Check if input_file is Markdown (.md)
if (input_file.endswith(".md")):
# Process updatedLine with addition Markdown conversion logic
updatedLine = process_line(updatedLine)
if (updatedLine.__eq__("---")):
bodyParagraph += "<hr>"
continue
else:
# Process updatedLine with addition Markdown conversion logic
updatedLine = process_line(updatedLine)

bodyParagraph += f"<p lang=\"{lang_attribute_value}\">" + updatedLine + "</p>\n"

Expand Down

0 comments on commit 3fab6c9

Please sign in to comment.