You can find it here.
Any feedback is very welcome!
You can find it here.
Judging from your String interpolation with
format! you are not XML escaping the values, which will mean your generated HTML/RSS will be invalid if the strings e.g. contain
You probably want to describe your tool as a "static-site generator" because that's what such a tool is commonly called.
A link in your README to a blog built with your static-site generator would be neat.
Ah, it's my first time working with XML, what's the best way of escaping strings such as this?
You are probably correct, the project is based on Luke Smith's LB so I just kept a similar description.
XML escaping strings is very simple ... there isn't really a "best way" ... you just do it.
Seeing that you depend on
quick-xml you could use its Writer with
Event::Text events which are automatically escaped. That would probably however make your code a bit more verbose.
It seems like you are parsing the HTML & RSS files, modifying them and then writing them again? ... that is unusual. Static-site generators normally convert input files to output files. And I think that approach is cleaner since you can then e.g. easily update the template.
I didn't realize it was as simple as replacing some characters, I have now fixed that issue. Thanks for your input, I really appreciate it!
Perhaps you are misunderstanding:
- It converts the Markdown to HTML and saves it.
- It then edits the Rolling Blog and RSS files to include the entry.
I have made it a little clearer in the code.
I am afraid you still don't understand. Every string you interpolate into an XML or HTML document should be escaped unless you are absolutely certain that it doesn't contain these characters. So unless I am mistaken
entry.kebab etc. should also be escaped.
<![CDATA[...]]> in XML is special ... what's in there must not be escaped.
It then edits the Rolling Blog and RSS files to include the entry.
Yeah that's unusual. Static-site generators usually just generate files from scratch without any editing (because editing is more complex and error-prone). E.g. if you change the blog / RSS format in a future version this will probably break files using the old format.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.