Forum How do I...?

Hyphenation: break on ";"

jean
Hi there

I have HTML like this:

<td><code class="literal">Data Source=<em class="replaceable"><code>server012</code></em>;Initial Catalog=<em class="replaceable"><code>catalog1</code></em>;User Id=user;password=password</code></td>


I want Prince to break after ";" characters, so I added soft hyphen characters:

<td><code class="literal">Data Source=<em class="replaceable"><code>server012</code></em>;&shy;Initial Catalog=<em class="replaceable"><code>catalog1</code></em>;&shy;User Id=user;password=password</code></td>


Nothing happens. When I enable hyphenation, hyphens occur inside words as well, which I don't want. Enabling hypenation:

code.literal {
    hyphens: auto;
}


How should discretionary hyphens be done?
mikeday
If you want a break point without a hyphen, you can use zero-width space, &#x200B; or &zwsp; in HTML.
jean
Cool, that works. The with-a-hyphen soft break would also be very useful though.

In case anyone else wants to do this, I added a menu item to insert my zero-width-space for me in the XMLmind editor. In the file '../addon/config/docbook/common.incl' I added an element like this (just after all the other '<command>' elements):

<command name="docb.insertZeroWidthSpace">
  <macro undoable="true" label="Insert zero-width-space">
    <sequence>
      <command name="insertString" parameter="&#200B;"/>"
    </sequence>
  </macro>
</command>


Then I added a menu item. Just after the line '<menu label="DocBook"', I added:

<item label="Insert zero-width-space"
  command="docb.insertZeroWidthSpace"/>
<separator />


Restart XMLmind and Bob's your uncle. (Not Bob Stayton, though he's probably keeping an eye on things anyway.)
mikeday
Regarding soft-hyphens, the default value of "manual" appears to be treated equivalently to "none", which is not correct. We will fix this for the next release.
mikeday
We have fixed this issue in Prince 6.0 rev 6, and hyphens: manual (the default value) will now enable breaking words that contain hyphens.
jean
mikeday wrote:
enable breaking words that contain hyphens.


Apologies if I'm missing something, but what does this mean for soft hyphens?
I.e. a break that is invisible in the middle of a line, e.g. "something", but visible when the word is split over two lines, e.g. "some-
thing"?
mikeday
Breaking at soft-hyphens is enabled when the hyphens property is set to manual (the default) or auto, and disabled when the hyphens property is set to "none".