2017 © Pedro Peláez
 

neos-carbon hyphen

Make hyphens easier in Neos CMS

image

carbon/hyphen

Make hyphens easier in Neos CMS

  • Tuesday, May 15, 2018
  • by jonnitto
  • Repository
  • 1 Watchers
  • 0 Stars
  • 170 Installations
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 221 % Grown

The README.md

![Latest stable version] ![Total downloads] ![License] ![GitHub forks] ![GitHub stars] ![GitHub watchers], (*1)

Carbon.Hyphen Package for Neos CMS

Make hyphens easier

Optional word-breaks are hard to enter in Neos CMS. This package provides a Fusion wrapper for phpSyllable, (*2)

Installation

composer require carbon/hyphen

Usage

Text

Just use the Carbon.Hyphen:Text Fusion object as a processor or wrapper on the Fusion value that should be hyphenated., (*3)

superlongValue = 'supercalifragilisticexpialidocious'
superlongValue.@process.hyphenate = Carbon.Hyphen:Text {
  locale = 'en-gb'
}

HTML

Similar to text elements you can use Carbon.Hyphen:Html for HTML elements., (*4)

someFusionHtml.@process.hyphenate = Carbon.Hyphen:Html

Neos CMS integration example

You can easily activate hyphenation for all Neos CMS text- and headline nodetypes with following Fusion code:, (*5)

prototype(Foo.Bar:Content.Text) {
  renderer.@process.hyphenate = Carbon.Hyphen:Html
}

prototype(Foo.Bar:Content.Headline) {
  title.@process.hyphenate = Carbon.Hyphen:Text
}

or directly on a specific parameter:, (*6)

prototype(Foo.Bar:Component) {
    headline = Neos.Neos:Editable {
        property = 'headline'
        block = false
    }

    renderer = afx`
        <h2>
            <Carbon.Hyphen:Text>{props.headline}</Carbon.Hyphen:Text>
        </h2>
    `
}

Parameters

locale (string) : Reference to the language in which the given string will be hyphenated
(Have a look at syllable languages for a reference of available languages), (*7)

threshold (integer, default = 0) : Minimum amount characters a word needs to have, before it is being hyphenated., (*8)

Custom language mappings

Probably you've got a language defined that is not available in syllable. For example, en is not available, but en-gb is. Because of that, you can map your language preset to another syllable language: Per default following settings are set in Settings.Carbon.yaml:, (*9)

Carbon:
  Hyphen:
    # Throw exception if no hyphen definition is found
    throwException: true
    mapping:
      en: en-gb
      de-de: de
      de-at: de

Credits

This implementation was heavily inspired by packagefactory/hyphenate., (*10)

The Versions

15/05 2018

dev-master

9999999-dev

Make hyphens easier in Neos CMS

  Sources   Download

MIT

The Requires

 

helper carbon flow neos fusion

15/05 2018

1.0.1

1.0.1.0

Make hyphens easier in Neos CMS

  Sources   Download

MIT

The Requires

 

helper carbon flow neos fusion

11/05 2018

1.0.0

1.0.0.0

Make hyphens easier in Neos CMS

  Sources   Download

MIT

The Requires

 

helper carbon flow neos fusion