BetaMasaheft / Documentation

Die Schriftkultur des christlichen Äthiopiens: Eine multimediale Forschungsumgebung
3 stars 3 forks source link

Could a small transformation script/tool be put up somewhere to quickly calculate the fol. from page? #1851

Closed PietroLiuzzo closed 2 years ago

PietroLiuzzo commented 2 years ago

Could a small transformation script/tool be put up somewhere to quickly calculate the fol. from page? e.g. (p+1)/2=f+r if the number is whole and f+v if there is a fraction on top, resulting in, e.g. for p. 99 or p. 100 (99+1)/2=50--->50r (100+1)/2=50.5--->50v I know it is a simple operation but maybe some automation could help avoid mistakes if there are a lot of page pointers in a paginated manuscript?

Originally posted by @eu-genia in https://github.com/BetaMasaheft/Documentation/issues/913#issuecomment-985541885

PietroLiuzzo commented 2 years ago

I am not sure about the context of usage and the old issue does not help me. Which mistakes in the page pointers do you refer to? could you please point to a specific example and describe what is the expected behaviour?

If you want to encode this in oxygen, you can create a code template. Go to preferences, search for code templates, add one to the list. You can assign it the short cut you prefer and paste in the following:

${xpath_eval(
let $f := floor((number('${selection}')+1) div 2) return
if(number('${selection}') mod 2 = 1) then ($f|| 'r') else ($f|| 'v'))}
<!-- ${selection} -->

in the editor select 99 and press your selected keys combination. You will get 50r and a comment containing 99. for a page reference to be marked as if it was folia (but why???) you could edit this to go like

<locus target="#${xpath_eval(
let $f := floor((number('${selection}')+1) div 2) return
if(number('${selection}') mod 2 = 1) then ($f|| 'r') else ($f|| 'v'))}"
> ${selection} </locus>

selecting your 99 will return <locus target="#50r">99</locus>

eu-genia commented 2 years ago

thank you! we have quite a few paginated manuscripts where we need, as far as I understand, to always recalculate the folio number from page number, and I thought this could speed up the process and help us avoid mistakes so I have a text starting on page 99 in a ms, I want it to result in <locus target="#50r">99</locus> without doing fractions )

PietroLiuzzo commented 2 years ago

and does the above help you? you do not need to do fractions, only press your selected key combinations when encoding.

eu-genia commented 2 years ago

it does, thank you, can it be used also by those who do not use Oxygen though? (@DenisNosnitsin1970 has a paginated ms for example that he is describing, and I guess he uses ATOM)

PietroLiuzzo commented 2 years ago

not that I am aware, no. unless somebody is willing to write a plugin for atom which I am not able to do.