Re: Preserving leading zeros

2023-05-29 Thread Ihor Radchenko
William Denton  writes:

> I'm thinking about moving a personal library catalogue system into Org.  This 
> would involve ISBNs, and when ISBNs had 10 digits some would have leading 
> zeros. 
> It turns out leading zeros are removed when something looks like a number.
>
> #+name:isbn
> | 0006145396 |
>
> #+begin_src shell :results output :var string=isbn
> echo $string
> #+end_src
>
> #+RESULTS:
> : 6145396

Try 
#+name:isbn
| "0006145396" |

Currently, Org unconditionally converts everything that looks like a
number into numbers using `read'.

We could, in theory, allow passing ;L flags or similar when reading
table reference (see 3.5.2 Formula syntax for Calc). Feel free to write
a feature request if you think that it might be useful.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Preserving leading zeros

2023-05-28 Thread tomas
On Sun, May 28, 2023 at 01:50:15PM -0400, William Denton wrote:
> On 28 May 2023, Berry, Charles wrote:
> 
> > Have you considered http://gewhere.github.io/org-bibtex ??
> > 
> > Or using the approach therein, viz. use properties to store bib data in org?
> 
> That would be great for a smaller bibliography, but I'm dealing with over
> 2,400 books [...]

> |   isbn | title| pub_date |
> |+--+--+
> | 0006145396 | A Buyer's Market | 1952 |

Perhaps not very elegant, but sticking "ISBN" in front of that would work.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: Preserving leading zeros

2023-05-28 Thread William Denton

On 28 May 2023, Berry, Charles wrote:


Have you considered http://gewhere.github.io/org-bibtex ??

Or using the approach therein, viz. use properties to store bib data in org?


That would be great for a smaller bibliography, but I'm dealing with over 2,400 
books.  They're in a simple database now, with a web front end I wrote over 
twenty years ago in Perl.  Amazingly it's worked ever since, maybe with one fix 
required along the way, but some update to a library or package broke it 
recently and I haven't figured out why yet.  Even if I do, I'm thinking it's 
time to get away from that code.


I don't feel like getting into the overhead of writing a new web-based system, 
so I might try managing the database through Org with R.  I was thinking I might 
add a new book by having a table like this, which the code would read and 
operate on:


|   isbn | title| pub_date |
|+--+--+
| 0006145396 | A Buyer's Market | 1952 |

I guess I could have the code pad the left with zeros if the ISBN is a number 
with fewer than 10 digits.  That way I'd see the right ISBN on the screen, and 
if Emacs removes the zeros they get put back before it's added to the 
catalogue.


Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada
CO₂: 424.57 ppm (Mauna Loa Observatory, 2023-05-27)

Re: Preserving leading zeros

2023-05-28 Thread Berry, Charles
William,

Have you considered http://gewhere.github.io/org-bibtex ??

Or using the approach therein, viz. use properties to store bib data in org?

HTH,
Chuck

> On May 28, 2023, at 7:46 AM, William Denton  wrote:
> 
> I'm thinking about moving a personal library catalogue system into Org.  This 
> would involve ISBNs, and when ISBNs had 10 digits some would have leading 
> zeros. It turns out leading zeros are removed when something looks like a 
> number.
> 

[snip]