View Single Post
Old 03-26-2021, 04:07 PM   #20
fbrzvnrnd
Fanatic
fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.fbrzvnrnd ought to be getting tired of karma fortunes by now.
 
Posts: 559
Karma: 400004
Join Date: Feb 2009
Device: ONYX M96
Quote:
Originally Posted by reinsley View Post
Yes, Amazon's PDF.
Sorry, I mean: your final ebook is only for kindle or ePub?

Quote:
As said at the very beginning of the topic, I didn't know where to go.
I am in front of a Himalayan climb with the wrong tools.
I did C coding years ago, not enough practice to save time.
Anyway, it was an enjoyable exercise, I appreciated your help and that of other readers.
I am more and more comfortable with Regex to correct and free up reading time, which is ultimately the ultimate goal.

Best regards
You can speed up some things. For example: create the questions giving to the div a unique id that you keep as list somewhere, and work only on correct answers. The wrong answers are linked to a non-existent id created with the original id with before a prefix. For example:

Code:
<div class="question" id="one">
<p>Who is the french king during the french revolution?</p>
<ul>
<li><a href="#due">correct answer</a></li> 
<li><a href="#wrong_uno">wrong answer</a></li> 
<li><a href="#wrong_uno">another answer</a></li> 
<li><a href="#wrong_uno">last answer</a></li> 

</ul>
</div>

<div class="question" id="two">
<p>Is Lady Oscar a real or fiction character?</p>
<ul>
<li><a href="#tre">correct answer</a></li> 
<li><a href="#wrong_due">wrong answer</a></li> 
<li><a href="#wrong_due">another answer</a></li> 
<li><a href="#wrong_due">last answer</a></li> 

</ul>
</div>
...and so on, working only on questions and correct answers. This is a more affordable work. After, you put the id list you kept on a blank text edit page:

Code:
one
two
three
four
...
And use a regex to create all the wrong answers for all the questions in an instant. Something similar to:

Code:
FIND:
(.+)

REPLACE:
<div class="answer" id="wrong_$1">
<p>Sorry, this was not the correct answer.</p>
<p><a href="#$1">Try it again</a><p>
</div>
In this way you can focus the work only on questions, and automate the creation of all the wrong answers pages. After the regex replace, you copy & paste the result in the same file of the questions.
Now you have a file with all the questions with correct and wrong links, as internal links. The last passage I suggest is to split this big file before every <div>, so you are sure to have a page break for each answer/question.
fbrzvnrnd is offline   Reply With Quote