Any chance a 3rd Ed. ASLRB will be published?

c600g

Member
Joined
May 11, 2016
Messages
132
Reaction score
87
Location
Oceanside, CA
Country
llUnited States
I've been working on an HTML version of the rulebook as well, using CSS stylesheets and a bit of javascript for nice footmark tooltips. I've also managed to use lunr.js to index it and provide an off-line search capability. I have chapters A, B, C, D, E, and most of G done. It has been a lot of work, but I find it very useful to have one or more chapters open during a VASL game, etc.

Below are a few sample screenshots of the rulebook in action.

Alan

chap a.12.png chap d.3.png search.png
 

jrv

Forum Guru
Joined
May 25, 2005
Messages
20,096
Reaction score
4,482
Location
Teutoburger Wald
Country
llIceland
How many years till the asl rulesbook (1st edition) enters public domain?
Many, many. This site says, "the term of protection is the shorter of 95 years from first publication, or 120 years from the date of creation" for a work for hire. From the 1985 publication date that would be 2080.

JR
 

Vinnie

See Dummies in the index
Joined
Feb 9, 2005
Messages
15,758
Reaction score
1,669
Location
Aberdeen , Scotland
Country
llUnited Kingdom
I've been working on an HTML version of the rulebook as well, using CSS stylesheets and a bit of javascript for nice footmark tooltips. I've also managed to use lunr.js to index it and provide an off-line search capability. I have chapters A, B, C, D, E, and most of G done. It has been a lot of work, but I find it very useful to have one or more chapters open during a VASL game, etc.

Below are a few sample screenshots of the rulebook in action.

Alan

View attachment 6071 View attachment 6072 View attachment 6073
I'm bumping my head against adding a search field to my RB. Is lunr.js the way to go and can you give me pointers?
 

jrv

Forum Guru
Joined
May 25, 2005
Messages
20,096
Reaction score
4,482
Location
Teutoburger Wald
Country
llIceland
I'm bumping my head against adding a search field to my RB. Is lunr.js the way to go and can you give me pointers?
It looks like *a* way to go. One would have to create a series of "documents" for each numbered rule (or perhaps paragraph). Something like the below might work (stitched together from the lunr web site examples; no guarantee it will run):

Code:
var documents = [ { id: 1, title: "A.1: DICE", body: "The rules often require use ..." }, { id: 2, title: "A.2 ERRORS", body: "All results stand once play has progressed..." }, ... ];
var idx = lunr(function () {
  this.field('title')
  this.field('body')
  this.ref('id')

  documents.forEach(function (doc) {
    this.add(doc)
  }, this)
});

var listOfResults = idx.search( "stand" );

// display list of results and/or move view to appropriate display page
Once you had a particular "document" it would be up to you to display the rule/paragraph so that the search term was highlighted. This would also mean that rather than having fixed html, you would need to use code to display the "documents" for viewing your eASLRB (or you could dynamically parse your html, or you could have both fixed html and json documents, but then you run the risk that the two would fall out of sync).

JR
 
Last edited:

Vinnie

See Dummies in the index
Joined
Feb 9, 2005
Messages
15,758
Reaction score
1,669
Location
Aberdeen , Scotland
Country
llUnited Kingdom
It looks like *a* way to go. One would have to create a series of "documents" for each numbered rule (or perhaps paragraph). Something like the below might work:

Code:
var documents = [ { id: 1, title: "A.1: DICE", body: "The rules often require use ..." }, { id: 2, title: "A.2 ERRORS", body: "All results stand once play has progressed..." }, ... ];
var idx = lunr(function () {
  this.field('title')
  this.field('body')
  this.ref('id')

  documents.forEach(function (doc) {
    this.add(doc)
  }, this)
});

var listOfResults = idx.search( "stand" );
Once you had a particular "document" it would be up to you to display the rule/paragraph so that the search term was highlighted. This would also mean that rather than having fixed html, you would need to use code to display the "documents" for viewing your eASLRB (or you could dynamically parse your html, or you could have both fixed html and json documents, but then you run the risk that the two would fall out of sync).

JR
I'm going to need hand holding to do this! Maybe Cassie will cover it in her higher syllabus!
 

jrv

Forum Guru
Joined
May 25, 2005
Messages
20,096
Reaction score
4,482
Location
Teutoburger Wald
Country
llIceland
I'm going to need hand holding to do this! Maybe Cassie will cover it in her higher syllabus!
I think you are hoping this library will do the soup-to-nuts searching process. It actually does a very small part of the searching process. I am guessing you have a bunch of html pages. You want the search library to go through those pages and bring up the first page containing that string, highlight the text, then pop up a window that will allow you to go to the next or previous instance, rather like pressing ctrl-f in your browser but over multiple pages. This library does not do that, although it could be part of code that does that. It does not understand html nor files. It does not build any UI like "next" or "previous" buttons nor build code that will do navigation. It expects you will present it with an array of json objects with text to search through and a string for which to search. It will then return a list of identifiers for the json objects that contain that search string. It is up to you to get the list of json objects to it, and it is up to you to do something with the list of results. If you decided to use this code it would also be necessary for you to strip the html from the text you provide (unless you want to search tags as well as actual rules text) and to standardize the text for html encoding (if the user searches for "> 0", that will probably be in your html as "> 0", and if you look for "> 0", you won't find "> 0").

There may be a library that "does it all," but I have not done any research on that so I can't make any suggestions.

JR
 

Vinnie

See Dummies in the index
Joined
Feb 9, 2005
Messages
15,758
Reaction score
1,669
Location
Aberdeen , Scotland
Country
llUnited Kingdom
I think you are hoping this library will do the soup-to-nuts searching process. It actually does a very small part of the searching process. I am guessing you have a bunch of html pages. You want the search library to go through those pages and bring up the first page containing that string, highlight the text, then pop up a window that will allow you to go to the next or previous instance, rather like pressing ctrl-f in your browser but over multiple pages. This library does not do that, although it could be part of code that does that. It does not understand html nor files. It does not build any UI like "next" or "previous" buttons nor build code that will do navigation. It expects you will present it with an array of json objects with text to search through and a string for which to search. It will then return a list of identifiers for the json objects that contain that search string. It is up to you to get the list of json objects to it, and it is up to you to do something with the list of results. If you decided to use this code it would also be necessary for you to strip the html from the text you provide (unless you want to search tags as well as actual rules text) and to standardize the text for html encoding (if the user searches for "> 0", that will probably be in your html as "> 0", and if you look for "> 0", you won't find "> 0").

There may be a library that "does it all," but I have not done any research on that so I can't make any suggestions.

JR
I understand this, just not certain how to implement it. What I'm thinking will be the solution is tobtranslare the entirety of the RB into a text database and pluck outbtge paragraph numbers the search string exists in. The RB is not large in terms of simple text, I reckon it would be less than a meg just straight text. It's the graphics which make it big.
 

jrv

Forum Guru
Joined
May 25, 2005
Messages
20,096
Reaction score
4,482
Location
Teutoburger Wald
Country
llIceland
I understand this, just not certain how to implement it. What I'm thinking will be the solution is tobtranslare the entirety of the RB into a text database and pluck outbtge paragraph numbers the search string exists in. The RB is not large in terms of simple text, I reckon it would be less than a meg just straight text. It's the graphics which make it big.
That sounds like one approach. What you mean by a "text database" is not clear to me. It might be data in a dbms system (various relational systems, various NoSql systems, and others), or it might be a simple series of text blobs with little (json) or no (plain text) structure. For search you have to do something about the markup (including links to include images) & html encoding (I would probably store without encoding, and only encode on display).

JR
 

Philippe D.

Elder Member
Joined
Jul 1, 2016
Messages
1,362
Reaction score
502
Location
Bordeaux
Country
llFrance
Getting the ASLRB into EPUB format would be great - I'd take it with me all the time with my ereader (though I'm not sure how good the software is with non-linear navigation - with the ASLRB, you need some good navigation options for all those rules references - go there and come back, at the very least).
 

c600g

Member
Joined
May 11, 2016
Messages
132
Reaction score
87
Location
Oceanside, CA
Country
llUnited States
I'm bumping my head against adding a search field to my RB. Is lunr.js the way to go and can you give me pointers?
Vinnie,

lunr.js may work for you, but it will likely require (a) your data to be formatted somewhat regularly, and (b) you'll need someone who knows javascript fairly well for the creation of the index data and then implementing the search functionality in a web page.

When I created my HTML ASL rulebook, I decided to go with a single chapter per HTML file, with javascript to hide/display sections as required. I used HTML5, so the top level <article> corresponds to a section in the chapter (e.g. "A1, A2, ... A26"), and then each section under a given article is a numbered rule (e.g." A1.12 MULTI_MAN COUNTERS").

Each section has a <h2> header that corresponds to the title of the section, as well as one or more <p> that contain the rules text for that section.

Here is a sample from chapter A:
HTML:
            <article id="A1">
                <header>
                    <h1><a name="A1"></a>PERSONNEL COUNTERS</h1>
                </header>
                <section>
                    <p><img src="img/a1.png" alt="" /></p>
                    <h2><a name="A1.1"></a>1.1</h2>
                    <p>There are two kinds of Personnel counters with several varieties of each. The values of each unit will
                        vary from one nationality to another and are listed on the National Capabilities Chart (<a href="#A25"
                            class="articleNav">A25</a>).</p>
                </section>
                <section>
                    <h2><a name="A1.11"></a>1.11 SINGLE-MAN COUNTER (SMC)</h2>
                    <p><img src="img/a1.11.png" class="img-left" alt="">SMC are elite <span class="exc">[EXC: Partisans]</span>                        units which bear a single silhouette and represent just one man. There are two types of SMC: leader
                        and hero. Each is described in detail later.</p>
                </section>
                <section>
                    <h2><a name="A1.12"></a>1.12 MULTI-MAN COUNTERS (MMC)</h2>
                    <p>MMC are units which bear the silhouette of more than one man and represent a number of men who perform
                        as a group. There are three types of MMC: squad, HS, and crew. A vehicle’s <em>inherent</em> crew
                        is not a MMC until it leaves the vehicle and takes the form of a counter.</p>
                </section>
...
Once I have the HTML files done, I then have to create an index. I decided to implement a global index covering all of the chapters I've completed, that way a single search can pull up results from the entire rulebook. To create the index, I used node.js and a few packages (primarily cheerio) to parse the relevant HTML files, looking only at the stuff I want to index, creating it, then outputting it to a large file. Finally, I created a search page which loads the index data into a javascript array, and wired up some javascript to a textbox which searches the array.

I did this several months ago, and I'm not a big node.js guy and as such the details are a bit foggy.

Hope this helps a bit,
Alan
 

jrv

Forum Guru
Joined
May 25, 2005
Messages
20,096
Reaction score
4,482
Location
Teutoburger Wald
Country
llIceland
Getting the ASLRB into EPUB format would be great - I'd take it with me all the time with my ereader (though I'm not sure how good the software is with non-linear navigation - with the ASLRB, you need some good navigation options for all those rules references - go there and come back, at the very least).
The internal format of epub is html. I just did a quick test with one page of the ASLRB which I had OCRed (as plain text) previously. I used calibre (a free epub reader/editor) to create an empty epub, do some minimal formatting, and add a link. Works beautiful. I did not test adding images, but that looks straight-forward. I did a search in the reader; worked nicely. As I adjusted the reader size, the page sizes change. I expect there is a way to put a header & footer on the pages so that one can figure out what page one is on in the paper ASLRB. It looks as though javascript & css are supported. One could imagine having a radio button to switch between, say, V2 & pocket paging, plus, say, checkboxes to turn on/off different errata. I can only guess as I have spent just a few minutes playing around with it. If I were thinking about doing a project like this, I would probably look very seriously at an .epub output rather than .html. The work is very similar, but you don't have to write search code. It's built in to the reader.

JR
 

Vinnie

See Dummies in the index
Joined
Feb 9, 2005
Messages
15,758
Reaction score
1,669
Location
Aberdeen , Scotland
Country
llUnited Kingdom
The internal format of epub is html. I just did a quick test with one page of the ASLRB which I had OCRed (as plain text) previously. I used calibre (a free epub reader/editor) to create an empty epub, do some minimal formatting, and add a link. Works beautiful. I did not test adding images, but that looks straight-forward. I did a search in the reader; worked nicely. As I adjusted the reader size, the page sizes change. I expect there is a way to put a header & footer on the pages so that one can figure out what page one is on in the paper ASLRB. It looks as though javascript & css are supported. One could imagine having a radio button to switch between, say, V2 & pocket paging, plus, say, checkboxes to turn on/off different errata. I can only guess as I have spent just a few minutes playing around with it. If I were thinking about doing a project like this, I would probably look very seriously at an .epub output rather than .html. The work is very similar, but you don't have to write search code. It's built in to the reader.

JR
I converted my html one to an epub. works fine but i need to delete the javascript part that allows you to jump between chapters as they add 10 essentially blank pages to the start of each chapter.
 

jrv

Forum Guru
Joined
May 25, 2005
Messages
20,096
Reaction score
4,482
Location
Teutoburger Wald
Country
llIceland
I experimented some with javascript for navigation. I added a button and called code:

Code:
<head>
  <title>test ASLRB</title>
  <script>
    function gotoP2() {
      window.document.location = "page2.xhtml";
      return false;
    }
  </script>
</head>

<body>
  <button onclick="gotoP2();">Click me!</button>
I didn't get any blank pages, and the window jumped to the second page. What I found was that the reader was unaware of the jump, and it "lost" the first page. I couldn't use the calibre reader navigation to page back. I could add a similar button on the second page, but then I couldn't use the reader nav to go to the second page although the button on the first page still worked.

Actually on more experimentation it is more complicated than that. If after pressing the button on the first page I then navigate the calibre reader using page back nothing happens but if I page down until the end of the second page then page up, I go back to the first page. It looks as though the reader is unaware of the navigation done by the javascript. I have not been able to find documentation on how one should keep the epub reader informed about transitions.

JR
 

Vinnie

See Dummies in the index
Joined
Feb 9, 2005
Messages
15,758
Reaction score
1,669
Location
Aberdeen , Scotland
Country
llUnited Kingdom
How did you do the jumping?

BTW there are some sample epubs here: http://bbebooksthailand.com/samples.html.

JR
Using this.



<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="../index.html">Table of Contents</a>
<a href="../A/A.html">Infantry</a>
<a href="../B/B.html">Terrain</a>
<a href="../C/C.html">Ordnance & Off-Board Artillery</a>
<a href="../D/D.html">Vehicles</a>
<a href="../E/E.html">Miscellaneous</a>
<a href="../F/F.html">North Africa</a>
<a href="../G/G.html">Pacific Theatre</a><a href="../H/H.html">Design Your Own</a><a href="../I/I.html">Starter Kit</a><a href="../J/J.html">Delux</a><a href="../O/O.html">Red Barricades</a>
<a href="../OM/OM.html">Operation Merkur</a>
<a href="../P/P.html"> Kampfgruppe Peiper</a>
<a href="../Q/Q.html"> Pegasus Bridge</a>
<a href="../R/R.html"> A Bridge Too Far</a>
<a href="../S/S.html"> Solitaire ASL</a>
<a href="../T/T.html"> Blood Reef: Tarawa</a>
<a href="../V/V.html"> Valor of the Guards</a>
<a href="../Z/Z.html"> Kakazu Ridge and others</a>
<a href="../FB/FB.html"> Festung Budapest</a>
<a href="../Tables/Tables.html"> Tables</a>
<a href="../AK/AK.html"> Africa Korps</a>
<a href="../BFP/BFP.html"> Bounding Fire Productions</a>
<a href="../LC/LC.html"> Lone Canuck Productions</a>
<a href="../LFT/LFT.html"> Le Franc Tireur</a>
<a href="../CH/CH.html"> Critical Hit!</a>
<a href="../KE/KE.html"> Kinetic Energy</a>
<a href="../Flow/Flow.html"> Flowcharts</a>
<a href="../Over/Over.html"> Overlays</a>
<a href="../DCG/DCG.html"> Dinant</a>
<a href="../0/0.html"> Index & Glossary</a>

</div>
<span id="index" style="font-size:30px;cursor:pointer" onclick="openNav()"><img src="../Symbol/toc.gif"></span>
 
Top