co-analysis / a11ytables

R package: generate best-practice stats spreadsheets for publication
https://co-analysis.github.io/a11ytables/
Other
40 stars 3 forks source link

Choose how to handle auto-insertion of terminal periods #105

Open matt-dray opened 7 months ago

matt-dray commented 7 months ago

Currently, a terminal period will be added to strings in the blank_cells and source columns of an a11ytable-class object if they're missing. For example: Some text is converted to Some text., and Some text. remains as Some text..

The presence of hyperlinks (#47) complicates this. [Some text]() should become [Some text.](). We can detect the presence of a hyperlink in the string and take action if one is found. In this case, we can replace [^\.]\]\( (anything but a period, followed by close-square bracket and open parenthesis) with \.\]\(. What to do if the user provdes the string Here is [some text]() to consider.? It might convert to Here is [some text.]() to consider. and ultimately to [Here is some text. to consider.](), which is just not right.

Possible approaches:

  1. Write code to handle periods properly, even these edge cases. Is that too much effort and spaghetti just to append a period in the right place? Maybe, but it is an accessibility requirement, isn't it?
  2. Just warn the user if it appears there's no terminal period. Can be a bit looser in detection and won't need to write code to do the replacement.
  3. Simply don't bother; leave it entirely to the user, but document it.

As it stands, I think the approach to terminal periods is haphazard. I don't think they're checked on the cover anywhere; only in the blank_cells and source columns of an a11ytable. It should be consistent.