Another use for Jstar - AsciiDoc

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Another use for Jstar - AsciiDoc

    Since I like Jstar and the fountain markup language so much, I jumped to try out AsciiDoc and its compiler/parser, AsciiDoctor. Originally I wanted to use it to make ePub books and I've had some success doing that (and making PDF documents), but I found its primary purpose for writing HTML and that's where I've been spending most of my time — enough time where I've signed up for a free hosting service just to try it out.

    I wanted to see if I could host my short screenplays on the website and found out that it's incredibly easy to do so. Just five lines and I was able to create an adequate web page for a short script — I pasted in the formatted text screenplay (just as you would do it here).

    Code:
    == *Claws*
    === ©Centos
    
    ==== 5 page short. Romance/fantasy genre
    ----
         FADE IN:
    
         INT. KITCHEN — NIGHT
    
         A slight breeze ...
    
    (rest of script)
    ----
    That was it. And it results in this ...

    https://oldreaders.000webhostapp.com/claws2.html

    Nothing fancy, but a well formatted script on a web page.

    Two equal "==" marks, bigger header. Three = smaller. Four = smaller yet. (Title is one.) Asterisks = BOLD, (underscore would equal italic). Four hyphens tell it to set off a "literal" block (retain format) with monospace characters. That's it.

    Name the text files filename.adoc, compile them with AsciiDoctor ...

    Code:
    asciidoctor -b html5 filename.adoc
    You can do a lot more with AsciiDoc (and AsciiDoctor), including embedding images, videos (all media), creating tables, bullets, quotes ... etc. Setting up a table of contents (which each section is automatically added and linked to its section is done simply by putting ...

    Code:
    :toc:
    ... near the top of the document. You can also put it at the right side or left side by typing :toc: left or :toc: right and table of content levels are chosen using :toclevels: 4 (or 2, which is the default, or 3 or more).

    A great way to waste time.
    Last edited by Centos; 01-15-2019, 12:02 AM.
    STANDARD DISCLAIMER: I'm a wannabe, take whatever I write with a huge grain of salt.

  • #2
    Re: Another use for Jstar - AsciiDoc

    Centos ... Really nice result on the page that you linked to.

    I used to fool around with AsciiDoctor about seven or eight years ago.

    I will have a go at it again.

    Something that you probably are not thinking about is that you cannot use AsciiDoctor on a Windows machine unless you load software that is, regrettably and unforgivably, not part of the Windows out-of-the-box experience.

    Basically, you need to have the Ruby programming language installed. Ruby comes with Linux but not with Windows. I suppose that the greedy scum-suckers at Microsoft have always wanted to sell their own programming languages and were afraid to include Python and Ruby.

    But, fortunately, Ruby is free, and you can download it. I have it on some older computers, but I did not have it on my "new" computer, which I set up last spring. So I downloaded it just now. I will install it tomorrow. It is the middle of the night right now.

    It looks easier to set up than the older versions. You can even get a bundled version that comes with the Development Kit and installs MSYS2, which can compile the C code necessary for some Ruby gems (think of them as plug-ins). The Development Kit and MSYS used to be separate items to install, and they were a bit challenging, especially MSYS.

    After you, as a Windows user, have installed Ruby, you then need to install the AsciiDoctor gem (again, think of it as a plug-in). This is not all that difficult to do. I have done it several times in past years. I will explain how to do this when I report back.

    Of course, after you have done all this, you would then have to issue commands from the command line to use AsciiDoctor. And that would certainly make some people here crap a big load in their pants.

    I will report back in a day or two.
    Last edited by ComicBent; 01-16-2019, 03:55 AM.

    "The fact that you have seen professionals write poorly is no reason for you to imitate them." - ComicBent.

    Comment


    • #3
      Re: Another use for Jstar - AsciiDoc

      Hi ComicBent ... I figured you'd probably be the only one interested in this anyhow. You're right, Ruby is installed (by default) in Linux Mint. And AsciiDoc and AsciiDoctor are in the repositories, so it was easy in Linux Mint (Ubuntu repositories).

      I did to do some "Gem installs" to get AsciiDoctor to convert to PDF and ePub (not on this computer as its 2014 OS is too old to support it — Linux Mint 17.x support ends in April so I'll have to upgrade anyhow). I also had to install the Ruby development library for PDF and ePub, but it wasn't necessary for HTML.

      I was wondering what I installed when I installed AsciiDoc, then (after doing some reading) I found that it was based on Python. So I "compiled" (parsed, or whatever its called) the same page in AsciiDoc instead of AsciiDoctor and it looks completely different. I actually kind of like it. I was going to upload it to my free site for this post, but (right now) 000webhost is having problems with logins. (I guess you get what you pay for.) I'm guessing AsciiDoc is much more limited than AsciiDoctor, but I still want to take a look at it.

      I'm thinking of trying AsciiDoctor (and maybe AsciiDoc) on a Windows partition on my laptop, just to see how much work it would be to set up.

      EDIT: 000webhost login was working when I got home ...

      The same page "compiled" with AsciiDoc instead of AsciiDoctor.
      http://oldreaders.000webhostapp.com/claws3.html
      Last edited by Centos; 01-16-2019, 04:15 PM.
      STANDARD DISCLAIMER: I'm a wannabe, take whatever I write with a huge grain of salt.

      Comment


      • #4
        Re: Another use for Jstar - AsciiDoc

        Hey, Centos ...

        Yeah, a lot of this computer stuff (even when related to screenwriting issues) ends up being a conversation between you and me.

        I think that your idea of posting one's works online by the AsciiDoctor method is a good one, whether the works are screenplays, essays, stories, poems, or whatever.

        It took me several hours to gather the material and put it together, but I have spent time yesterday and today to write up a short but (I think) very efficient and helpful article on how to get Ruby and install it properly on a Windows machine. I will post it tomorrow evening. I lead a vampire life. I work at night and sleep till around noon (or later, to be honest ).

        I have to re-read everything to make sure that I made no mistakes, and I still have to add how to install the AsciiDoctor gem. Installing the gem will be easy as pie. But I need to lay out the method for anyone who wants to use it.

        I got really involved in Ruby a number of years ago. For various reasons (and not just my own laziness) I never made a lot of progress. But I have installed Ruby onto my new computer. I am happy to say that the environment is a better one than it used to be. MSYS2 appears to add a C/C++ environment as a huge tool for anyone who wants to do any development in Ruby. However, MSYS2 is probably unnecessary for anyone who is just interested in AsciiDoctor or the vast majority of Ruby gems, which do not require compilation of C code.

        I am familiar with the AsciiDoc/AsciiDoctor difference. AsiiDoc (Python) never really got off the ground as far as I know, and AsciiDoctor (Ruby) filled the void. AsciiDoctor is an implementation of the earlier Python application. I think what happened is that AsciiDoc got stuck in the Linux world, because AsciiDoc needed a particular toolchain that was available only in the Unix/Linux world. Python has always been a bit mired in the Linux world, though that has changed a good bit in recent years. Ruby was the same way, but I am really impressed that the MSYS2 environment is now part of the Windows installation. Sarcasm on: My continuing thanks to Microsoft for not providing us with Python, Ruby, and a C/C++ compiler in its 35-year history of graciously taking our money and then kicking us to the curb. Sarcasm off. Anyway, AsciiDoctor could be very useful. As you pointed out, it is very easy to use to format a screenplay for posting on a website.

        Anyway, I am off to bed for a few hours. I will post my "how to" article Thursday evening.
        Last edited by ComicBent; 01-17-2019, 04:40 AM. Reason: My vampire life made me forget what day it is already.

        "The fact that you have seen professionals write poorly is no reason for you to imitate them." - ComicBent.

        Comment


        • #5
          Re: Another use for Jstar - AsciiDoc

          You have to manually indent every line in the script?

          Comment


          • #6
            Re: Another use for Jstar - AsciiDoc

            Originally posted by dpaterso View Post
            You have to manually indent every line in the script?
            No, the four hyphens (at the beginning and end of the block) automatically tells AsciiDoc and AsciiDoctor to indent by one space.

            http://oldreaders.000webhostapp.com/clawsnoindent.html

            I use sed to prepend or remove leading spaces from each line.

            sed -i. 's/^/ /' filename.txt
            for prepending spaces in front of each line in Trelby text files (three spaces between / / -- or however many you want

            sed -i 's/^....//' filename.txt
            for removing a certain number of leading spaces in a text file (each dot equals a space).

            I don't even know how sed works anymore. I just wrote this down (the above) and saved it in Simplenote. I do have a link on my source saved there also.

            http://sed.sourceforge.net/sed1line.txt
            Tons of stuff on sed, here.

            I don't know how hard it is to get sed working on Windows, but I think it should be pretty easy.
            STANDARD DISCLAIMER: I'm a wannabe, take whatever I write with a huge grain of salt.

            Comment


            • #7
              Re: Another use for Jstar - AsciiDoc

              Originally posted by ComicBent View Post
              Anyway, I am off to bed for a few hours. I will post my "how to" article Thursday evening.
              Looking forward to reading the article (which is what your posts often are). Thanks. Obviously you know a whole lot more about AsciiDoc and AsciiDoctor, and Python and Ruby than I do. I'll probably follow your instructions to install it on the Windows 8.1 partition I have on a laptop I was given (it also runs Linux Mint Cinnamon, which is where it is most of the time).
              STANDARD DISCLAIMER: I'm a wannabe, take whatever I write with a huge grain of salt.

              Comment


              • #8
                Re: Another use for Jstar - AsciiDoc

                Not sure, but I think that Derek may have been talking about all the paragraph indents, not the margin at the left of the page.

                The paragraph indents come from the Trelby text file, I assume.

                I have just finished my article. I will have it posted here in a little while.

                "The fact that you have seen professionals write poorly is no reason for you to imitate them." - ComicBent.

                Comment


                • #9
                  Re: Another use for Jstar - AsciiDoc

                  Originally posted by ComicBent View Post
                  Not sure, but I think that Derek may have been talking about all the paragraph indents, not the margin at the left of the page.

                  The paragraph indents come from the Trelby text file, I assume.
                  Oh, okay. The formatted text used to come from Trelby, but now it mostly comes from fountain, via screenplain and pdftotext.

                  Originally posted by ComicBent View Post
                  I have just finished my article. I will have it posted here in a little while.
                  I'll be watching for it. Thanks.
                  STANDARD DISCLAIMER: I'm a wannabe, take whatever I write with a huge grain of salt.

                  Comment


                  • #10
                    Re: Another use for Jstar - AsciiDoc

                    UPDATE: I made a few minor corrections to the original text to prevent some misunderstandings. I also made a correction to a significant, though not especially consequential, error in the original (see red text below).

                    Okay, I will present this "how to" information for anyone who might find it useful, as in using Asciidoctor for creating an HTML version of a screenplay. I will say at the outset that Asciidoctor produces a zillion lines of superfluous HTML code (95 percent of which is incomprehensible). However, the resulting view in a browser is attractive. It is not exactly the way that I would want the script to look (too much space between paragraphs), but it is still nice in appearance.

                    Still, I think that Asciidoctor could have a place in posting certain kinds of things onto a website.

                    To use Asciidoctor, you need to have the Ruby interpreter. It comes with Linux (and, I think, with the Mac), but not with Windows. Fortunately you can install it in Windows for free, and it is very easy, especially if you just want the basic Ruby interpreter.

                    Most users only need the basic Ruby interpreter; they do not need the MSYS2 development environment, which is now available with the Ruby installer. But if you want to do some development, you will need the MSYS2 environment. I went ahead and installed Ruby and the MSYS2 environment (total: about 900M).


                    WINDOWS SYSTEMS

                    If you know that you never want to use Ruby for programming, you can skip to STEP 5 and just download Ruby version 2.5.3-1 (x64) without the DevKit.

                    If you think that you might do some programming or be using a great variety of Ruby gems (plug-ins), which may require older versions of Ruby, start with STEP 1 and download the installer that includes the DevKit (and MSYS2).

                    The first four steps below deal with obtaining a free version manager that makes it easy to switch between versions of Ruby.

                    Getting tired, bored, or confused? If so, just skip to STEP 5.

                    STEP 1: Download Uru

                    Uru is a version manager.

                    Download

                    It is a 32-bit program, but that is all right; it will work on your 64-bit machine.

                    The file is packed in the .7z format. You may need to download 7-Zip to unpack the the file. However, WinZip may also work if you already have it.

                    If you need to get 7-Zip:

                    Download 7-Zip

                    STEP 2: Unpack the Uru File

                    Use 7-Zip to unpack the .7z file to any folder. It will contain an installer named uru_rt.exe.

                    STEP 3: Move the uru_rt.exe Installer

                    You need to move the uru_rt.exe installer file to a folder that is already on your Path.

                    I use a folder called C:\Scripts. I created the folder and keep various script files in it. Of course, I added C:\Scripts to my Path statement.

                    STEP 4: Install Uru

                    I have uru_rt.exe in C:\Scripts, so I install it as follows from the C:\Scripts prompt:

                    C:\Scripts>uru_rt admin install

                    You have to run the installation program from the command prompt.

                    Believe it or not, I forgot and tried double-clicking the .exe file and was puzzled when nothing happened!

                    After I have run the installation, I see two new files in my C:\Scripts folder:

                    uru.bat
                    uru.ps1

                    I am finished here.

                    STEP 5: Download the Ruby Installer

                    As of the current date, the recommended version of Ruby is: 2.5.3-1 (x64).
                    Although not the very newest version, it is recent and has a large number of "rubies" (plug-ins) that can be used with it.

                    Download

                    (Again, if you want to do any development, download the version that includes the DevKit.)

                    STEP 6: Install Ruby
                    You install Ruby in the usual way (no command-line stuff).

                    The options during installation include the question of whether to put Ruby onto your PATH statement. If you are not planning to do future development with different versions of Ruby, select the option to put Ruby on the PATH. If you think that you may have multiple versions of Ruby in the future, decline the option to put Ruby onto the PATH. Informed opinion is that it is unnecessary to put Ruby onto the Path if you are using a version manager like Uru. (NOTE: You will be using Uru to select a Ruby version whenever you need to use the language. This is why you do not need to have a "system" Ruby version. I will show you, in a later step, how to use Uru.)

                    The installation of Ruby itself is quick and straightforward. At the very end the installer asks if you want to run "ridk install" to set up MSYS2 (this is the DevKit stuff). If you ever intend to use any "rubies" (plug-ins) written in C/C++, you need to have MSYS2. Honestly, I do not know how often this comes up (probably not often). But I went ahead and installed the MSYS2 environment. You probably will not need it. You can always install it later.

                    The MSYS2 installation is staightforwad, too, but takes a while. If I understand all of this correctly, you are essentially establishing a C/C++ programming environment by installing MSYS2. All you have to do is watch and wait as it installs (it takes six or seven minutes). At one point, and at the end, the installer asks which options you want, but fortunately tells you that you can just hit ENTER if you do not know (I suppose it installs everything if you do that).

                    By default, my Ruby installation went to:

                    C:\Ruby25-x64

                    STEP 7: Register Ruby with Uru

                    If you chose to let the Ruby installer put Ruby onto your PATH and you are not using Uru, you can skip this step.

                    Now that I have a Ruby version on my computer, I need to register it with Uru, so that Uru can tell the computer which version of Ruby I want to use (I will have only one version at first).

                    To register my Ruby version:

                    I go to the command prompt (C:\>) again, and type:

                    C:\> uru admin add C:\Ruby25-x64\bin\

                    After a few seconds, Uru reports on screen:

                    ---> Registered ruby at `C:\Ruby25-x64\bin` as `253p105`.

                    My first reaction was "Wha-a-t?"

                    The string `253p105` refers to the version number and is the name of this version of Ruby in Uru. However, I do not want to try to remember such a ridiculous name. Fortunately, I can give it a different name within Uru.

                    STEP 8: Give Ruby an Easier Name

                    You may skip this step if you are not using Uru.

                    I want to rename the Ruby version to something easy to remember. I want to use "ruby25" (the "25" stands for the 2.5 version number).

                    I do this at the command prompt.

                    C:\> uru admin retag 253p105 ruby25

                    And after a few seconds Uru reports on screen:

                    ---> retagged `253p105` to `ruby25`

                    STEP 9: Use Ruby

                    And now that I have Ruby installed, I will call up the Ruby interpreter (i.e., use Ruby). To do that, I go to the command prompt and call Ruby 2.5 by its Uru name:

                    C:\> uru ruby25
                    After a few seconds, Uru tells me that I am now using Ruby, and it gives me the version:
                    ---> now using ruby 2.5.3-p105 tagged as `ruby25`

                    At this point, I can now issue Ruby commands from the command prompt.

                    CORRECTION TO PREVIOUS NOTE: Originally I had a note here in which I said that Uru prepends (puts at the start) a special kind of entry to the PATH statement, so that in effect you have the current Ruby version on your PATH after all. That appears not to be true (and I am glad). What happened is that after I installed the Asciidoctor gem I found that Ruby had been added to the PATH, right at the top. It was Asciidoctor that did this, presumably so that the user could run the Asciidoctor gem from any prompt. The operative idea behind Uru is that you can shift from one version to another; but Uru does not change the PATH.

                    STEP 10: Install the Asciidoctor Gem

                    Installation of the Asciidoctor gem is simple. You can do it from an online repository. Ruby will know where to go to find the gem.

                    ONLINE

                    1: With Uru

                    If you are using Uru, go to a prompt (such as C:\>) and type:
                    uru ruby25

                    Wait for Uru to respond. Then, at the prompt, type:
                    gem install asciidoctor

                    Ruby goes to https://rubygems.org and finds the Asciidoctor gem, which it automatically downloads and installs. Asciidoctor also appears to put Ruby on the PATH (it did with my desktop installation). You could remove it from the PATH statement, but doing that is not really worth the trouble for the average user of Ruby.

                    2: Without Uru

                    You must have Ruby on the PATH. Go to any prompt and type:
                    ruby

                    Ruby loads. Now you can type:
                    gem install asciidoctor

                    That should install the Asciidoctor gem.

                    OFFLINE

                    I have not done it this way in a long time (if ever), but if you can somehow get the Asciidoctor gem, you should be able to install it from your "local" (computer) location. Go to the folder where you have temporarily stored the gem. Load Ruby in the way described above, whether with or without Uru. Then type at the prompt:
                    gem install <name of gem file>

                    If you are not at the prompt for the storage folder, you can type a complete path to the file, as in:
                    gem install <complete path to the gem filename>

                    That should install your gem.

                    Folks, I hope that I got all of this right. If you have questions, I will try to clarify and to correct any mistakes. I will say that anyone who has any idea of ever using Ruby should copy this article, because it sums up a whole lot of stuff that is not all that clear when you go out and try to figure it all out.
                    Last edited by ComicBent; 01-18-2019, 05:22 AM.

                    "The fact that you have seen professionals write poorly is no reason for you to imitate them." - ComicBent.

                    Comment


                    • #11
                      Re: Another use for Jstar - AsciiDoc

                      Originally posted by dpaterso View Post
                      You have to manually indent every line in the script?
                      The whole process ... in pictures (using Jstar with fountain format, screenplain, pdftotext and AsciiDoctor in Linux). No WYSIWYG until HTML.

                      http://oldreaders.000webhostapp.com/nothing.html

                      You could also just upload the PDF file, but that would too easy.

                      http://oldreaders.000webhostapp.com/nothing.pdf

                      Note: most text editors DO have dynamic line breaks. Jstar is kind of behind the times here.

                      I've put up another HTML file called nothingrevised.html to make a couple points clearer (and to goof around).

                      http://oldreaders.000webhostapp.com/nothingrevised.html
                      Last edited by Centos; 01-17-2019, 07:06 PM.
                      STANDARD DISCLAIMER: I'm a wannabe, take whatever I write with a huge grain of salt.

                      Comment


                      • #12
                        Re: Another use for Jstar - AsciiDoc

                        Thanks, ComicBent. I just went the lazy route, but it works for HTML on my Windows 8.1 partition. I've already got Jstar on that partition. I still like the way it works in Linux better, but that's because that's what I'm used to. To get into a terminal in Linux, I just press F12 (using Guake) . I can be typing a document in about a second. (Almost instant.)
                        STANDARD DISCLAIMER: I'm a wannabe, take whatever I write with a huge grain of salt.

                        Comment

                        Working...
                        X