* Preserving leading zeros
@ 2023-05-28 14:46 William Denton
2023-05-28 17:01 ` Berry, Charles
2023-05-29 8:04 ` Ihor Radchenko
0 siblings, 2 replies; 5+ messages in thread
From: William Denton @ 2023-05-28 14:46 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 898 bytes --]
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
I looked at org-babel-read, which calls org-babel--string-to-number ("If STRING
represents a number return its value"), so it looks like that's always going to
happen.
I could use a hack like prepending an X and then removing it later, but that's a
bit ugly. Has anyone had this problem and worked around it some other way?
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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Preserving leading zeros
2023-05-28 14:46 Preserving leading zeros William Denton
@ 2023-05-28 17:01 ` Berry, Charles
2023-05-28 17:50 ` William Denton
2023-05-29 8:04 ` Ihor Radchenko
1 sibling, 1 reply; 5+ messages in thread
From: Berry, Charles @ 2023-05-28 17:01 UTC (permalink / raw)
To: William Denton; +Cc: emacs-orgmode
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 <wtd@pobox.com> 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]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Preserving leading zeros
2023-05-28 17:01 ` Berry, Charles
@ 2023-05-28 17:50 ` William Denton
2023-05-28 18:40 ` tomas
0 siblings, 1 reply; 5+ messages in thread
From: William Denton @ 2023-05-28 17:50 UTC (permalink / raw)
To: Berry, Charles; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]
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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Preserving leading zeros
2023-05-28 17:50 ` William Denton
@ 2023-05-28 18:40 ` tomas
0 siblings, 0 replies; 5+ messages in thread
From: tomas @ 2023-05-28 18:40 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 606 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Preserving leading zeros
2023-05-28 14:46 Preserving leading zeros William Denton
2023-05-28 17:01 ` Berry, Charles
@ 2023-05-29 8:04 ` Ihor Radchenko
1 sibling, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2023-05-29 8:04 UTC (permalink / raw)
To: William Denton; +Cc: emacs-orgmode
William Denton <wtd@pobox.com> 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 <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-29 8:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-28 14:46 Preserving leading zeros William Denton
2023-05-28 17:01 ` Berry, Charles
2023-05-28 17:50 ` William Denton
2023-05-28 18:40 ` tomas
2023-05-29 8:04 ` Ihor Radchenko
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).