GeorgeBates
Elder Member
Nailed it. Wish you were here, StuG-boy....blue skies from pain?
Nailed it. Wish you were here, StuG-boy....blue skies from pain?
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.How many years till the asl rulesbook (1st edition) enters public domain?
Most of us already are.We’ll all be kinda ripe by then...
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?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
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):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?
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
I'm going to need hand holding to do this! Maybe Cassie will cover it in her higher syllabus!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:
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).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" );
JR
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").I'm going to need hand holding to do this! Maybe Cassie will cover it in her higher syllabus!
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.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
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).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.
not certain how to implement it.
Vinnie,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?
<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>
...
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.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).
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.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
How did you do the jumping?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.
<head>
<title>test ASLRB</title>
<script>
function gotoP2() {
window.document.location = "page2.xhtml";
return false;
}
</script>
</head>
<body>
<button onclick="gotoP2();">Click me!</button>
Using this.How did you do the jumping?
BTW there are some sample epubs here: http://bbebooksthailand.com/samples.html.
JR