Commit 64bde799 authored by julien's avatar julien

multiple fixes

parent 72c45e39
# Exporter update
## Blockquotes
Cite after an Extract:prose should go in the extract. the need to go to a new line should be set by the CSS on the exporter:
```html
<blockquote class="ex">
<cite>cite</cite>
</blockquote>
```
## Heading 3
Heading 3 is an inline element, and should be inside the paragraph element. To do so, we can either push that one on the exporter, or we script paged.js to update that one.
## Semantics heading
Chapter title = h1
heading 1 = h2
heading 2 = h3
heading 3 = h4
## List
- `list.none` should be an `<ul>` (not an `<ol>`)
- Same for questions and answers
Questions and answers should not be set as Q. / A. but should get the name of the one who talk.
\ No newline at end of file
Lumino questions
1. Can we have subtitle in the front matter (apparently not from the specs. where we can have an author)
2. From the specs, it seems that the part can only have a title. subtitle and epigraphs. And text start empty on the page after. Is that what we need? Should the part be written in the part chapter in editoria.
3. There is no un-numbered layout in the specs which is not a part of front/back matter. Therefore, i made a version based on the title, without any number
4. add an option to select the part of the chapter-title for the running header
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
:root {
--baseline: 16px;
--baseline-color: rgba(0, 200, 80, 0.6);
/* --baseline-color: rgba(0, 200, 80, 0.6); */
--baseline-color: transparent;
/* --baseline-color: white; */
}
......@@ -17,7 +17,7 @@
/* start of the first baseline: 30pt from top: putted it as 40px */
background-position-y: 40px;
&::after {
background: url(../img/grid2.png);
/* background: url(../img/grid2.png); */
/* background: url(../img/contents.png); */
/* background: url(../img/frontmatter.png); */
}
......
......@@ -43,3 +43,9 @@ p[data-split-original="true"] {
}
/* hack */
.pagedjs_page_content div section h1:first-child,
.pagedjs_page_content div section h1:first-child {
/* margin-top: 0; */
}
\ No newline at end of file
......@@ -22,9 +22,9 @@ h1.ct span.run {
@top-right {
content: string(chapterTitleRun, first) "\00A0\00A0\00A0\00A0\00A0" counter(page);
/* content: string(chapterTitleRun, first); */
padding-top: 2.6em;
padding-top: 12px;
text-align: right;
font-variant: oldstyle-nums all-small-caps;
font-variant: oldstyle-nums all-small-caps;
font-size: 9pt;
line-height: var(--font-lineheight);
letter-spacing: 0.05em
......@@ -41,14 +41,13 @@ h1.ct span.run {
@top-left {
content: counter(page) "\00A0\00A0\00A0\00A0\00A0" string(chapterTitleRun, first);
/* content: string(chapterTitleRun, first); */
padding-top: 2.6em;
padding-top: 12px;
font-size: 9pt;
line-height: var(--font-lineheight);
font-variant: oldstyle-nums all-small-caps;
font-size: 9pt;
line-height: var(--font-lineheight);
letter-spacing: 0.05em
}
/* @top-center {
margin-top: 1.15em;
......@@ -73,3 +72,5 @@ h1.ct span.run {
}
background: white;
}
......@@ -3,6 +3,10 @@
.toc {
page: toc;
a {
text-decoration: none;
}
}
@page toc {
......
......@@ -15,9 +15,9 @@ p {
text-indent: 1pc;
margin: 0;
padding: 0;
hyphens: auto;
orphans: 0;
widow: 0;
hyphens: none;
orphans: 2;
widows: 2;
&:first-of-type {
text-indent: 0;
}
......@@ -45,7 +45,8 @@ a {
font-family: var(--font-body)Link;
font-weight: 400;
text-decoration: none;
font-style: inherit;
font-style: italic;
text-decoration: underline;
&:hover {
color: var(--color-secondary);
}
......
......@@ -38,6 +38,9 @@
/* color: red; */
/* font-size: 5em; */
line-height: 0;
text-decoration: none;
font-weight: 600;
font-style: normal;
}
.note-chapterTitle {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta lang="en-US">
<link href="css/main.css" rel="stylesheet">
</head>
<script src="js/paged.js"></script>
<script>
var Hyphenopoly = {
require: {
"en-us": "FORCEHYPHENOPOLY"
},
paths: {
patterndir: "./js/hyphens/patterns/",
maindir: "./js/hyphens/"
},
setup: {
classnames: {
"hyphenate": {
// hyphen: "•"
}
}
},
handleEvent: {
hyphenopolyEnd: function (e) {
let previewer = new Paged.Previewer();
previewer.preview();
}
}
};
</script>
<script src="js/hyphens/Hyphenopoly_Loader.js"></script>
<body class="hyphenate" lang="en-US">
<div id="cover"> </div>
<section data-type="chapter">
<div class="running-chapter">Running chapter</div>
<div class="running-part">Running part</div>
<p>introduction of Peru’s CCT program, Juntos, a World Bank–supported program intended to tackle the acute impacts of poverty.</p>
<p>CCTs originated in Latin America, and today they are among the most evaluated social programs on the planet. The majority of evidence on CCT impacts comes from the Mexican program now called Progresa, which is one of the earliest, and now largest, CCTs. Regular evaluations were built into the program administration at the outset, and this set a significant precedent. Today, we have a robust body of evidence that policy makers draw on to maintain and expand existing programs and to support implementation of new initiatives. Most of the available evidence derives from quantitative research, especially experimental methods such as randomized control trials and quasi-experimental methods (e.g., regression discontinuity, propensity score matching, instrumental variable, and difference-in- differences; Lagarde et al. 2007; Leroy et al. 2009; Kabeer and Waddington 2015). This literature is largely concerned with measuring primary program objectives related to household consumption and the uptake of health and education services. While acknowledging some variation related to program design, the existing quantitative evidence tells us that CCTs are, overall, effective and efficient mechanisms for altering the health- and education-seeking behavior of poor households.</p>
<p>For instance, regarding health and nutrition, we know that CCTs are effectiveat increasing utilization of health services (Gertler 2000; Attanasio et al. 2005; Levy and Ohls 2007; Galasso 2011) and increasing household food consumption (Hoddinott and Skoufias 2004; Angelucci and Attanasio 2009; Resende and Oliveira 2008; Handa et al. 2009). Where CCT programs have been implemented with the goal of reducing maternal mortality, they have effectively increased pregnant women’s use of health services, including antenatal care and in-facility births (Lim et al. 2010; Glassman et al. 2013). CCTs have been linked to a reduction in neonatal, infant, and child mortality and, in particular, deaths attributable to poverty-related causes such as malnutrition and diarrhea (Barham 2011; Rasella et al. 2013). CCTs have been shown to produce better growth outcomes in children (i.e., reduction in stunting; Gertler 2004; Fernald et al. 2010; Andersen et al. 2015; Kandpal et al. 2016) and improvement in children’s motor skills and cognitive development (Fernald et al. 2008). Both outcomes are likely related to uptake of health services and increased household consumption. CCTs have also been successfully deployed to increase vaccination rates for such diseases as tuberculosis, measles, diphtheria, pertussis, tetanus, and polio (Morris et al. 2004; Barham 2005; Barham and Maluccio 2009).</p>
<p>Regarding the aim of building human capital through education, studies show that CCTs are effective at increasing school enrollment (Schultz 2004; Sadoulet et al. 2004; Behrman et al. 2005; Cardoso and Souza 2003; Dammert 2009; Attanasio et al. 2010). As is the case with health service usage, there is some variability related to gender, age, ethnicity, and location, but overall the evidence indicates a positive </p>
</section>
<section class="chapter" data-type="chapter" contenteditable="true">
<header>
<div class="cn">1</div>
<h1 class="ct">Of the Bookshelf <br> Long title might look like</h1>
<div class="running-chapter">Of the Bookshelf</div>
<div class="cst">A few of my own</div>
</header>
<p>At the most general level, comparison is not a special method, or in any way unique to anthropology. Comparison is implicit in any method of deriving understanding through <em>explanation.</em></p>
</section>
</body>
</html>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta lang="en-US">
<link href="css/main.css" rel="stylesheet">
</head>
<script>
var Hyphenopoly = {
require: {
"en-us": "FORCEHYPHENOPOLY"
},
paths: {
patterndir: "./js/hyphens/patterns/",
maindir: "./js/hyphens/"
},
setup: {
classnames: {
"hyphenate": {
// hyphen: "•"
}
}
},
handleEvent: {
hyphenopolyEnd: function (e) {
window.PagedPolyfill.preview();
}
}
};
</script>
<script src="js/hyphens/Hyphenopoly_Loader.js"></script>
<script>
window.PagedConfig = {
auto: false
};
</script>
<script src="js/paged.polyfill.js"></script>
<body class="hyphenate" lang="en-US">
<div id="cover"> </div>
<section data-type="chapter">
<div class="running-chapter">Running chapter</div>
<div class="running-part">Running part</div>
<p>introduction of Peru’s CCT program, Juntos, a World Bank–supported program intended to tackle the acute impacts of poverty.</p>
<p>CCTs originated in Latin America, and today they are among the most evaluated social programs on the planet. The majority of evidence on CCT impacts comes from the Mexican program now called Progresa, which is one of the earliest, and now largest, CCTs. Regular evaluations were built into the program administration at the outset, and this set a significant precedent. Today, we have a robust body of evidence that policy makers draw on to maintain and expand existing programs and to support implementation of new initiatives. Most of the available evidence derives from quantitative research, especially experimental methods such as randomized control trials and quasi-experimental methods (e.g., regression discontinuity, propensity score matching, instrumental variable, and difference-in- differences; Lagarde et al. 2007; Leroy et al. 2009; Kabeer and Waddington 2015). This literature is largely concerned with measuring primary program objectives related to household consumption and the uptake of health and education services. While acknowledging some variation related to program design, the existing quantitative evidence tells us that CCTs are, overall, effective and efficient mechanisms for altering the health- and education-seeking behavior of poor households.</p>
<p>For instance, regarding health and nutrition, we know that CCTs are effectiveat increasing utilization of health services (Gertler 2000; Attanasio et al. 2005; Levy and Ohls 2007; Galasso 2011) and increasing household food consumption (Hoddinott and Skoufias 2004; Angelucci and Attanasio 2009; Resende and Oliveira 2008; Handa et al. 2009). Where CCT programs have been implemented with the goal of reducing maternal mortality, they have effectively increased pregnant women’s use of health services, including antenatal care and in-facility births (Lim et al. 2010; Glassman et al. 2013). CCTs have been linked to a reduction in neonatal, infant, and child mortality and, in particular, deaths attributable to poverty-related causes such as malnutrition and diarrhea (Barham 2011; Rasella et al. 2013). CCTs have been shown to produce better growth outcomes in children (i.e., reduction in stunting; Gertler 2004; Fernald et al. 2010; Andersen et al. 2015; Kandpal et al. 2016) and improvement in children’s motor skills and cognitive development (Fernald et al. 2008). Both outcomes are likely related to uptake of health services and increased household consumption. CCTs have also been successfully deployed to increase vaccination rates for such diseases as tuberculosis, measles, diphtheria, pertussis, tetanus, and polio (Morris et al. 2004; Barham 2005; Barham and Maluccio 2009).</p>
<p>Regarding the aim of building human capital through education, studies show that CCTs are effective at increasing school enrollment (Schultz 2004; Sadoulet et al. 2004; Behrman et al. 2005; Cardoso and Souza 2003; Dammert 2009; Attanasio et al. 2010). As is the case with health service usage, there is some variability related to gender, age, ethnicity, and location, but overall the evidence indicates a positive </p>
</section>
<section class="chapter" data-type="chapter" contenteditable="true">
<header>
<div class="cn">1</div>
<h1 class="ct">Of the Bookshelf <br> Long title might look like</h1>
<div class="running-chapter">Of the Bookshelf</div>
<div class="cst">A few of my own</div>
</header>
<p>At the most general level, comparison is not a special method, or in any way unique to anthropology. Comparison is implicit in any method of deriving understanding through <em>explanation.</em></p>
</section>
</body>
</html>
# Version History
## Version 2.3.0 (Juli 26, 2018)
### Hyphenopoly_Loader.js and Hyphenopoly.js:
* Don't use template strings [#28](https://github.com/mnater/Hyphenopoly/issues/28)
* run feature test for wasm support only if necessary
### hyphenopoly.module.js:
* define node >=8.3.0 as requirement (for util.TextDecoder)
* small refactorings
## Version 2.2.0 (June 26, 2018)
* provide example.js for RunKit
* use tap instead of mocha
* [6f9e539](https://github.com/mnater/Hyphenopoly/commit/6f9e539a5dab2d1eff5bdeb0c7857c6fda9eb41e)
* bugfix: [#24](https://github.com/mnater/Hyphenopoly/issues/24): [aeefe6e](https://github.com/mnater/Hyphenopoly/commit/aeefe6e3a59e8356abc99ca490acabf6c3374d7b)
## Version 2.1.0 (Mai 27, 2018)
* Configure Travis-CI
* bugfixes
## Version 2.0.0 (Mai 27, 2018)
* Provide node module (https://github.com/mnater/Hyphenopoly/wiki/Node-Module)
* default file locations better reflect usual installations [#19](https://github.com/mnater/Hyphenopoly/issues/19)
* Add ability to store results of feature tests (optional) [#22](https://github.com/mnater/Hyphenopoly/issues/22)
* better error handling (f4bbaa7759eed24208e5cd7c744f1131262abb20, 1c7b0b67666b507d6f6b02eea38460562a5835e4)
* correct implementation of e.preventDefault (df988788db6fb7120fc0c8a1cff1c91aac5a3998)
* fix string normalization (a3229f730f79ccdd3054cbac257b2345f5c8e11a)
* Better tooling: minify, eslint, testing (mocha), compiling (https://github.com/mnater/Hyphenopoly/wiki/Usage-of-devDependencies)
## Version 1.0.1 (Mai 13, 2018)
Prevent browsers to force layout on feature test in some cases.
## Version 1.0.0 (Mai 12, 2018)
First release
This diff is collapsed.
This diff is collapsed.
The MIT License (MIT)
Copyright (c) 2018 Mathias Nater
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Hyphenopoly.js
[![Build Status](https://travis-ci.org/mnater/Hyphenopoly.svg?branch=master)](https://travis-ci.org/mnater/Hyphenopoly) [![Coverage Status](https://coveralls.io/repos/github/mnater/Hyphenopoly/badge.svg?branch=master)](https://coveralls.io/github/mnater/Hyphenopoly?branch=master) [![dependencies Status](https://david-dm.org/mnater/Hyphenopoly/status.svg)](https://david-dm.org/mnater/Hyphenopoly) [![devDependencies Status](https://david-dm.org/mnater/Hyphenopoly/dev-status.svg)](https://david-dm.org/mnater/Hyphenopoly?type=dev) [![npms score](https://badges.npms.io/hyphenopoly.svg)](https://npms.io/search?q=hyphenopoly)
Hyphenopoly.js is a __JavaScript-polyfill for hyphenation in HTML__: it hyphenates text if the user agent does not support CSS-hyphenation at all or not for the required languages and it is a __Node.js-module__.
The package consists of the following parts:
- _Hyphenopoly_Loader.js_ (~13KB unpacked, ~2.5KB minified and compressed): feature-checks the client and loads other resources if necessary.
- _Hyphenopoly.js_ (~30KB unpacked, ~4KB minified and compressed): does the whole DOM-foo and wraps (w)asm.
- _hyphenEngine.wasm_ (~1KB uncompressed): wasm code for creating pattern trie and finding hyphenation points.
- _hyphenEngine.asm.js_ (~7KB uncompressed, ~1KB minified and compressed): fallback for clients that don't support wasm.
- _pattern.hpb_ (sizes differ! e.g. en-us.hpb: ~29KB): space saving binary format of the hyphenation patterns (including their license).
- _hyphenopoly.module.js_: the node module
# Usage (Browser)
Place all code for Hyphenopoly at the top of the header (immediately after the `<title>` tag) to ensure resources are loaded as early as possible.
You'll have to insert two script blocks. In the first block provide the initial configurations for Hyphenopoly_Loader as inline script. In the second block load Hyphenopoly_Loader.js as external script.
Also, don't forget to enable CSS hyphenation.
[Example](http://mnater.github.io/Hyphenopoly/example1.html):
```html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Example 1</title>
<script>
var Hyphenopoly = {
require: {
"la": "honorificabilitudinitas",
"de": "Silbentrennungsalgorithmus",
"en-us": "Supercalifragilisticexpialidocious"
},
setup: {
classnames: {
"container": {}
}
}
};
</script>
<script src="./Hyphenopoly_Loader.js"></script>
<style type="text/css">
body {
width:60%;
margin-left:20%;
}
p {
text-align: justify;
margin: 0 2em 0 0;
}
.container {
display: flex;
hyphens: auto;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
}
</style>
</head>
<body>
<h1>Example 1</h1>
<div class="container">
<p lang="la">Qua de causa Helvetii quoque reliquos Gallos virtute praecedunt, quod fere cotidianis proeliis cum Germanis contendunt, cum aut suis finibus eos prohibent aut ipsi in eorum finibus bellum gerunt.</p>
<p lang="en-us">For which reason the Helvetii also surpass the rest of the Gauls in valor, as they contend with the Germans in almost daily battles, when they either repel them from their own territories, or themselves wage war on their frontiers.</p>
<p lang="de">Aus diesem Grund übertreffen auch die Helvetier die übrigen Gallier an Tapferkeit, weil sie sich in fast täglichen Gefechten mit den Germanen messen, wobei sie diese entweder von ihrem Gebiet fernhalten oder selbst in deren Gebiet kämpfen.</p>
</body>
</html>
```
Let's go through this example step by step:
## UTF-8
Make sure your page is encoded as utf-8.
## First script block – configurations
Hyphenopoly_Loader.js needs some information to run. This information is provided in a globally accessible Object called `Hyphenopoly`. Hyphenopoly_Loader.js and (if necessary) Hyphenopoly.js will add other methods and properties only to this object – there will be no other global variables/functions beyond this object.
### require
The `Hyphenopoly` object must have exactly one property called `require` which itself is an object containing at least one nameValuePair where the name is a language code string (Some patterns are region-specific. See the patterns directory for supported languages. E.g. just using `en` won't work, use either `en-us`or `en-gb`) and the value is a long word string in that language (preferably more than 12 characters long).
Hyphenator_Loader.js will feature test the client (aka browser, aka user agent) for CSS-hyphens support for the given languages with the given words respectively. In the example above it will test if the client supports CSS-hyphenation for latin. If your page contains more than just one language just add more lines.
If you want to force the usage of Hyphenopoly.js for a language (e.g. for testing purposes) write `"FORCEHYPHENOPOLY"` instead of the long word.
## Second script block – load and run Hyphenopoly_Loader.js
Hyphenopoly_Loader.js tests if the browser supports CSS hyphenation for the language(s) given in `Hyphenopoly.require`. If one of the given languages isn't supported it automatically hides the documents contents and loads Hyphenopoly.js and the necessary patterns. Hyphenopoly.js – once loaded – will hyphenate the elements according to the settings and unhide the document when it's done. If something goes wrong and Hyphenopoly.js is unable to unhide the document Hyphenopoly_Loader.js has a timeout that kicks in after some time (defaults to 1000ms) and unhides the document and writes a message to the console.
If the browser supports all required languages the script deletes the `Hyphenopoly`-object and terminates without further ado.
## enable CSS-hyphenation
Hyphenopoly by default hyphenates elements (and their children) with the classname `.hyphenate`. Don't forget to enable CSS-hyphenation for the classes eventually handled by Hyphenopoly.
# Usage (node)
[![Try hyphenopoly on RunKit](https://badge.runkitcdn.com/hyphenopoly.svg)](https://npm.runkit.com/hyphenopoly)
Install:
````
npm i hyphenopoly
````
````javascript
"use strict";
const hyphenopoly = require("hyphenopoly");
const hyphenator = hyphenopoly.config({
"require": ["de", "en-us"],
"hyphen": "•",
"exceptions": {
"en-us": "en-han-ces"
}
});
async function hyphenate_en(text) {
const hyphenateText = await hyphenator.get("en-us");
console.log(hyphenateText(text));
}
async function hyphenate_de(text) {
const hyphenateText = await hyphenator.get("de");
console.log(hyphenateText(text));
}
hyphenate_en("hyphenation enhances justification.");
hyphenate_de("Silbentrennung verbessert den Blocksatz.");
````
# Automatic hyphenation
The algorithm used for hyphenation was developed by Franklin M. Liang for TeX. It works more or less like this:
1. Load a set of precomputed language specific patterns. The patterns are stored in a structure called a trie, which is very efficient for this task.
2. Collect all patterns that are a substring of the word to be hyphenated.
3. Combine the numerical values between characters: higher values overwrite lower values.
4. Odd values are hyphenation points (except if the hyphenation point is left from leftmin and right from rightmin), replace them with a soft hyphen and drop the other values.
5. Repeat 2. - 4. for all words longer than minWordLength
Example:
````
Hyphenation
h y p h e n a t i o n
h y3p h
h e2n
h e n a4
h e n5a t
1n a
n2a t
1t i o
2i o
o2n
h0y3p0h0e2n5a4t2i0o2n
Hy-phen-ation
````
The patterns are precomputed and available for many languages on CTAN. Hyphenopoly.js uses a proprietary binary format (including pattern licence, metadata and the patterns). Patterns are computed from a large list of hyphenated words by a program called patgen. They aim to find some hyphenation points – not all – because it's better to miss a hyphenation point then to have some false hyphenation points. Most patterns are really good but none is error free.
These pattern vary in size. This is mostly due to the different linguistic characteristics of the languages.
# Hyphenopoly.js vs. Hyphenator.js
Hyphenator.js (https://github.com/mnater/Hyphenator) started 2007 and had evolved ever since.
But web browsers have evolved much more!
Almost all of them support native hyphenation (https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens) for a specific set of languages (https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens#Browser_compatibility). So it was time for something new!
Hyphenopoly.js is based on Hyphenator.js (they share some code) but - in favor of simplicity and speed – lacks many features of Hyphenator.js. Most of these features aren't needed in modern webdesign anymore:
- dropped support for usage as bookmarklet
- dropped support for frames
- dropped support for ancient browsers
- dropped caching of patterns in browser storage
- dropped breaking of non-textual content (urls, code etc.)
- and some more…
If you need one of those features use Hyphenator.js – or give some feedback and proof that the feature is really useful and should be implemented in Hyphenopoly.js
On the other hand Hyphenopoly has a much finer-grained configuration system that allows you to make settings based on CSS-classes.
And last but not least it is faster than Hyphenator.js
const hyphenopoly = require("hyphenopoly");
const hyphenator = hyphenopoly.config({
"require": ["de", "en-us"],
"hyphen": "•",
"exceptions": {
"en-us": "en-han-ces"
}
});
async function hyphenate_en(text) {
const hyphenateText = await hyphenator.get("en-us");
console.log(hyphenateText(text));
}
async function hyphenate_de(text) {
const hyphenateText = await hyphenator.get("de");
console.log(hyphenateText(text));
}
hyphenate_en("hyphenation enhances justification.");
hyphenate_de("Silbentrennung verbessert den Blocksatz.");
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Example 1</title>
<script>
var Hyphenopoly = {
require: {
"la": "honorificabilitudinitas",
"de": "Silbentrennungsalgorithmus",
"en-us": "Supercalifragilisticexpialidocious"
},
paths: {
patterndir: "./patterns/",
maindir: "./"
},
setup: {
classnames: {
"container": {
}
}
}
};
</script>
<script src="./Hyphenopoly_Loader.js"></script>
<style type="text/css">
body {
width:60%;
margin-left:20%;
}
p {
text-align: justify;
margin: 0 2em 0 0;
}
.container {
display: flex;
hyphens: auto;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
}
</style>
</head>
<body>
<h1>Example 1</h1>
<div class="container">
<p lang="la">Qua de causa Helvetii quoque reliquos Gallos virtute praecedunt, quod fere cotidianis proeliis cum Germanis contendunt, cum aut suis finibus eos prohibent aut ipsi in eorum finibus bellum gerunt.</p>
<p lang="en-us">For which reason the Helvetii also surpass the rest of the Gauls in valor, as they contend with the Germans in almost daily battles, when they either repel them from their own territories, or themselves wage war on their frontiers.</p>
<p lang="de">Aus diesem Grund übertreffen auch die Helvetier die übrigen Gallier an Tapferkeit, weil sie sich in fast täglichen Gefechten mit den Germanen messen, wobei sie diese entweder von ihrem Gebiet fernhalten oder selbst in deren Gebiet kämpfen.</p>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
{
"name": "hyphenopoly",
"version": "2.4.0",
"description": "Hyphenation for node and Polyfill for client-side hyphenation.",
"keywords": [
"hyphenation",
"html",
"polyfill",
"hyphens",
"hyphen",
"soft",
"hyphenate",
"JavaScript"
],
"homepage": "https://github.com/mnater/Hyphenopoly",
"bugs": "https://github.com/mnater/Hyphenopoly/issues",
"license": "MIT",
"author": {
"name": "Mathias Nater",
"email": "mathiasnater@gmail.com"
},
"files": [
"hyphenEngine.asm.js",
"hyphenEngine.wasm",
"Hyphenopoly_Loader.js",
"Hyphenopoly.js",
"patterns/",
"min/",
"example.js",
"example.html"
],
"browser": "Hyphenopoly_Loader.js",
"main": "hyphenopoly.module.js",
"engines": {
"node": ">=8.3.0"
},
"repository": {
"type": "git",
"url": "https://github.com/mnater/Hyphenopoly"
},
"dependencies": {},
"devDependencies": {
"eslint": "^5.5.0",
"tap": "^12.0.1",
"terser": "^3.8.2"
},
"eslintConfig": {
"parserOptions": {
"ecmaVersion": 8
},
"env": {
"browser": true,
"es6": true
},
"globals": {
"Hyphenopoly": true
},
"extends": "eslint:all",
"rules": {
"require-unicode-regexp": 0,
"require-jsdoc": [
"error",
{
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": true,
"FunctionExpression": true
}
}
],
"no-template-curly-in-string": 2,
"prefer-template": 0,
"wrap-iife": 1,
"max-lines": 0,
"max-lines-per-function": 0,
"max-len": [
1,
{
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}
</