On 12/22/2015 11:43 AM, Joseph Polizzotto wrote:
> Alberto,
>
> Yes, I would like the ability to add spans to the xhtml files within
> Sigil.
I will see what I could do after I am done with porting aeneas to Python
3 --- that is, mid January or later.
> Also, what can you recommend that I currently do when commanding Icarus to
> write ids around all the existing <word> spans that are in my xhtml files?
> (These word spans are already numbered.) I tried adding <word>% but to no
> avail. Should I also erase the h1, h2 and p etc. tags when customizing
> this box (search for <word> only) in the plug-in menu?
I am not sure about what you are trying to achieve, so I can just
explain in detail what icarus does, you choose what suits your needs best.
(In any case, the plugin assumes that the XHTML files are created inside
Sigil. If they come from another source, you might want/need to "clean"
them. I cannot be too specific, it depends on your work flow. The
rationale of the plugin is to give a Sigil user the possibility of
creating an EPUB 3 Audio-eBook with just Sigil and aeneas/
aeneasweb.org,
with the minimum labor possible.)
First of all, if you want to work on <span> tags, you need to add "span"
in the "Tags to process" field. If you want the MO fragments to be
*only* <span> elements, your "Tags to process" should contain *only* "span".
When you click the "Add MO class and id" button, for each element whose
tag name appears in "Tags to process":
1. if the element has the "no MO class name" (default: "nomo"), it will
not change it;
2a. otherwise, if the tag has no id attribute, the plugin generates a
new id value and adds the latter and the class="mo" to the tag;
2b. otherwise (the tag has an id attribute), if the value of the id
attribute matches the current MO id regex/format (i.e., the id was
generated by the plugin in a previous run), the plugin generates a new
id value, and replaces the previous id value, and it adds the class="mo"
to the tag;
2c. otherwise (the tag has an id attribute, but it does not match the
current MO id regex/format), the plugin keeps the existing id and it
adds the class="mo" to the tag.
Examples:
1.
<span class="nomo">Word</span> => <span class="nomo">Word</span>
2a.
<span>Word</span> => <span class="mo" id="f000001">Word</span>
2a.
<span class="foo">Word</span> => <span class="foo mo"
id="f000001">Word</span>
2b.
<span class="mo" id="f000001">Word</span> =>
<span class="mo" id="f000001">Word</span>
2b.
<span id="f000001">Word</span> => <span class="mo" id="f000001">Word</span>
2c.
<span id="foo">Word</span> => <span class="mo" id="foo">Word</span>
The config.xml file in the ZIP file exported by "Export aeneas job ZIP
file" instructs aeneas to consider only the tags with "mo" in their
class value. This allows the user to synchronize the contents of tags
with pre-existing id values and of tags with id values generated by the
plugin.
(BTW, if you want to remove the class="mo" before exporting your EPUB 3,
you can use the "Remove MO class only" button.)
=== === ===
So, if you already have your XHTML files with a markup like:
<p>
<span id="word001">first</span>
<span id="word002">second</span>
<span id="word003">third</span>
</p>
you can simply change the MO ID regex/format to
word[0-9]{3}
word%03d
and press the "Add MO class and id" button. You will get the following:
<p>
<span id="word001" class="mo">first</span>
<span id="word002" class="mo">second</span>
<span id="word003" class="mo">third</span>
</p>
Note that the values of "MO ID regex/format" are in Python format (i.e.,
PCRE-like regex, C-like format). The above example should be
self-explaining.
> I like the plugin. It does what it says and makes my workflow much faster.
Good. Maybe other users will express their interest; so far you are the
only one (which is not a great incentive to me to work on it).
AP