gfngfn / SATySFi

A statically-typed, functional typesetting system
GNU Lesser General Public License v3.0
1.16k stars 83 forks source link

Primitives that can not be used in text-mode. #141

Closed puripuri2100 closed 5 years ago

puripuri2100 commented 5 years ago

This primitives can not be used in text-mode of SATySFi . Is this a bug?

Environment

Example

file name : test.saty

let document bt =
  let tinfo = get-initial-text-info () in
    stringify-block tinfo bt

let-block tinfo +p it = stringify-inline tinfo it

let-inline \test =
  let fuga = 120.5mm /' 1pt in
    {test}

in

document '<
  +p{hoge\test;}
>

compile :

satysfi --text-mode "text" test.saty -o test.txt

error log :

satysfi --text-mode "text" test.saty -o test.txt
 ---- ---- ---- ----
  target file: 'test.txt'
  dump file: 'test.satysfi-aux' (already exists)
  parsing 'test.saty' ...
 ---- ---- ---- ----
  reading 'test.saty' ...
! [Type Error] at "test.saty", line 9, characters 21-23:
    undefined variable '/''.
gfngfn commented 5 years ago

No, it is not a bug, but is an intended behavior. The primitives that handle lengths are disabled in the text mode on purpose. However, if it can be inconvenient in some situation, I am not so reluctant to recover these primitives.

puripuri2100 commented 5 years ago

Used to convert length type to string type.

let show-length len = show-float (len /' 1pt) ^ `pt`
gfngfn commented 5 years ago

Modified by the following commit: 59aedacb4522e4eee3526637278fd25660d6eb22.