diff --git a/qsgen2 b/qsgen2
index 54dd76b..8109668 100755
--- a/qsgen2
+++ b/qsgen2
@@ -796,60 +796,93 @@ function _cleanup() {
echo "${cleaned_content}"
}
-function _html() {
+_html() {
local content="${1}"
local debug=false
if ${debug}; then _msg debug "_html: Converting QStags in content"; fi
- # Convert QStags to HTML using Perl, strictly matching the QStags list
- local html_content=$(echo "${content}" | perl -pe '
- BEGIN {
- # Define a hash of QStags to their HTML equivalents
- %qstags = (
- "#BR" => "
\\n",
- "#BD" => "", "#EBD" => "\\n",
- "#I" => "", "#EI" => "\\n",
- "#P" => "
", "#EP" => "
\\n",
- "#Q" => "", "#EQ" => "
\\n",
- "#C" => "", "#EC" => "
\\n",
- "#H1" => "", "#EH1" => "
\\n",
- "#H2" => "", "#EH2" => "
\\n",
- "#H3" => "", "#EH3" => "
\\n",
- "#H4" => "", "#EH4" => "
\\n",
- "#H5" => "", "#EH5" => "
\\n",
- "#H6" => "", "#EH6" => "
\\n",
- "#STRONG" => "", "#ESTRONG" => "\\n",
- "#EM" => "", "#EEM" => "\\n",
- "#DV" => "", "#EDV" => "
\\n",
- "#SPN" => "", "#ESPN" => "\\n",
- "#UL" => "\\n",
- "#OL" => "", "#EOL" => "
\\n",
- "#LI" => "", "#ELI" => "\\n",
- "#U" => "", "#EU" => "\\n",
- "#TBL" => "\\n",
- "#TR" => "", "#ETR" => "
\\n",
- "#TD" => "", "#ETD" => " | \\n",
- "#TH" => "", "#ETH" => " | \\n",
- "#ART" => "", "#EART" => "\\n",
- "#SEC" => "\\n",
- "#ASIDE" => "\\n",
- "#NAV" => "\\n",
- "#BTN" => "\\n",
- "#SEL" => "\\n",
- "#OPT" => "\\n",
- "#LT" => "<", "#GT" => ">", "#NUM" => "#"
- );
- }
- while (my ($key, $value) = each %qstags) {
- s/(?",
+ "#EH1": "",
+ "#H2": "",
+ "#EH2": "
",
+ "#P": "",
+ "#EP": "
",
+ "#BR": "
",
+ "#BD": "",
+ "#EBD": "",
+ "#I": "",
+ "#EI": "",
+ "#STRONG": "",
+ "#ESTRONG": "",
+ "#EM": "",
+ "#EM": "",
+ "#DIV": "",
+ "#EDIV": "
",
+ "#SPAN": "",
+ "#ESPAN": "",
+ "#UL": "",
+ "#OL": "",
+ "#EOL": "
",
+ "#LI": "",
+ "#ELI": "",
+ "#U": "",
+ "#EU": "",
+ "#TABLE": "",
+ "#TR": "",
+ "#ETR": "
",
+ "#TD": "",
+ "#ETD": " | ",
+ "#TH": "",
+ "#ETH": " | ",
+ "#ART": "",
+ "#EART": "",
+ "#SEC": "",
+ "#ASIDE": "",
+ "#NAV": "",
+ "#BTN": "",
+ "#SEL": "",
+ "#OPT": "",
+ "#LT": "<",
+ "#GT": ">",
+ "#NUM": "#",
+ }
+ return qstag_dict.get(qstag, qstag) # Replace or return unchanged
+
+# Define the regular expression pattern for QStags
+pattern = r'#\w+'
+
+# Replace QStags using the defined function
+result = re.sub(pattern, replace_qstags, '$content')
+
+print(result)
+EOF
+)
+
+ # Execute the Python code and capture the output
+ local html_content=$(python -c "${python_code}")
echo "${html_content}"
}
+
# Time to test the first function
#_msg std "Running function blogs"
_blogs