This is a simple PHP program that takes an edited/pre-formatted Asciidoc document, splits it into the specific sections or chapters defined (based upon the first and second level headers, for further levels, please use the Alexandria client), generates a curated publication from that file, and writes it to the relays selected.
You will need to have php (including php-cli) and composer installed on the machine and configured.
Then run composer install
to download the dependencies to a vendor folder and create the composer.lock file.
- Open the folder user, create the file nostr-private.key and add your nsec to it.
- Then edit the file relays.yml containing your list of relays. We recommend keeping wss://thecitadel.nostr1.com in your list and adding at least one other, that you have write access to. If you remove all relays, the Citadel relay will be used as default.
a
tags will always contain thecitadel relay as relay hint. - Decide whether you want your 30040 index to contain
e
tags or the newera
tag version (according to NIP-62). This is denoted by adding the corresponding letter to the end of the command line arguments. I recommend usinga
. - Return to the main/upper folder, create an Asciidoc file entitled something like MyShortBookTitle.adoc and have it formatted with precisely two levels of headers.
= title you want as the full book title (mind the space after the hashtag)
== topic1
text that you want displayed as content
== topic2
more text
- On the command line, write
php createBook.php MyShortBookTitle.adoc "Author Name" "book version" a
and press Enter. Make sure to replace the filename with the short title you want to use and the author name with the name or npub of the person/entity that should be listed as the author in the 30040 event. The book version is the edition, translation, etc. of the book. The a denotes that you want the replaceablea
tags. - All of the event metadata will be added to the eventsCreated.txt file.
- The 30040 eventID will be sent to stdout (usually the command line) in the form of an njump hyperlink. The link will not work, if you wrote to a local relay, but you can still see the eventID.
To check that everything is installed correctly, you can run
./vendor/bin/phpunit src/IntegrationTest.php
to see the integration test, if you have PHPUnit installed.