-
-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Adding nonbreakablespace lua filter #114
Comments
Thank you Tomas, I appreciate the offer! Could you tell a bit more about the use-cases of this filter? If I understand correctly, then this is for text written in Czech. I'd like to understand why it is needed, and whether it supports a common typographical convention. If it solves a common problem for Czech writers, then I believe it should fit in. For the case that this is a less general filter, an alternative would be to host it in you own repository and tag the repo with the In either case, I'll be happy to help and provide more feedback. |
Indeed you are correct. The functions with regexes inside are trying to find before mentioned patters in strings, that for some reason are not parsed to Also, I am trying to detect strings that have different quotation marks inside them - I have found a simple filter proposed by jgm, that changes quotation marks inserted by pandoc to chosen UTF symbols, which sadly produces Strings like which in such case:
my filter would not detect the "a" with starting quotation mark. With those regexes it should. Well, I am not using the official The filter is far from perfect, doesnt cover every typografical aspect, and also might require user intervention depending on his language requirements, but I dare to say that it is a good start. I have tested it in Some references in this topic (on Using non-breaking space Also this issues led to creation of So the use-case would be general writing with level of typography in mind, that requires conformity with this rule. In Czech, this is widely known, but sometimes neglected (due to Sure, posting it in my repository is great too, but I dare to say that having any filter accepted here is a kind of quality-assurance, which I would like to achieve (and follow any requirements or recommendations). Final note: It seems that code formatting little broke; I am using notepad, which automatically introduces tabs instead of spaces. If neccessary, I try to fix that. |
Thanks for the resources, this helped. I agree that the filter is an excellent fit for this repo, and I'll be glad to merge it. Would you like to open a PR? There are some remaining questions and possible modifications. I apologize beforehand for me being a rather critical reviewer. The strictness is mostly motivated by the fact that I must be able to maintain any filter in case the original author become unavailable and we have to include fixes, or updates to newer pandoc versions. We also try to use a consistent style for the filters.
Thanks! |
I definitely will open a Pull Request then. I have to say, it will be me first time doing that, so please bear with me ... :) I prepare a suitable README, test and makefile. About the first bullet, I did excluded them just on basis in which there are no such one-letter words in Czech language. The filter could be written in such a way, to just prohibit any one-letter word being at the end of the line. But I know about people that want actually to go beyond this rule and even prevent two-letter prefixes being "orphaned" at the end of a line. I thought, that for people like that, I would like to offer easy option to tweak filter behavior. Second: Oh, OK, I must have seen that somewhere. I fix that. Third: So after modifying
write
Did I get that correctly? As a lua newbie, I have never seen that. Fourth: OK, I must have missed that. I change that, but I very much prefer I will get the modifications done in few days time, currently I am experiencing regular autumn cold, so I will get to it when I will be in full strength again. |
if prefixes[word] then
-- do what you need to do when word is a prefix
end
…--
Better --help|less than helpless
Den ons 7 okt. 2020 20:07Delanii <notifications@github.com> skrev:
I definitely will open a Pull Request then. I have to say, it will be me
first time doing that, so please bear with me ... :) I prepare a suitable
README, test and makefile.
I do understand your requirements, and also value that, because for me
being a beginner is kind of easier to follow some guidelines, or rules.
About the first bullet, I did excluded them just on basis in which there
are no such one-letter words in Czech language. The filter could be written
in such a way, to just prohibit *any* one-letter word being at the end of
the line. But I know about people that want actually to go beyond this rule
and even prevent two-letter prefixes being "orphaned" at the end of a line.
I thought, that for people like that, I would like to offer easy option to
tweak filter behavior.
Second: Oh, OK, I must have seen that somewhere. I fix that.
Third: So after modifying prefixes table as you suggest, I should in for
loop in function findOneLetterPrefix (to be renamed) instead of:
for index, prefix in ipairs(prefixes) do
write
for word in prefixes[word] do
Did I get that correctly? As a lua newbie, I have never seen that.
Fourth: OK, I must have missed that. I change that, but I very much prefer
camelCase over snake_case; it kinda drew me out of playing with Rust,
which compiler is very restrictive even in functions naming.
I will get the modifications done in few days time, currently I am
experiencing regular autumn cold, so I will get to it when I will be in
full strength again.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#114 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAI3OU3C5IY3VXSXO76ZH7DSJSUZ7ANCNFSM4SBOIGUQ>
.
|
I have actually found out that the filter does not work for I try to fix that. EDIT: I am still struggling with the suggestion about membership checking. Even with @bpj clarification I am unable to make it work. I have settled with following
If try following changes:
making the whole code to:
It doesnt work, no Space replacement is done for the Could you help me with accomodating for this requirement with an simple example? I have tryed to find something on SO or in "Programming in Lua," but I wasnt successfull. On the other side, I have already all required files prepared - filter file, test file, correct test result and |
Hello mr. Tarleb,
with your help, I have finished writing and testing filter that introduces non-breakable space before or after specific strings. If I would prepare informative
README.md
and addmakefile
and data to perform tests, would you be interested in adding this filter to this repository?I tryed to follow the lua-code style recommendations and also added comments that should clarify enough what I am doing (wanting to do).
Next goes final code of the filter:
Looking forward to you reply.
Regards, Tomas
The text was updated successfully, but these errors were encountered: