Merge pull request #4 from jawira/1-catalog

Add emoji catalog #1
This commit is contained in:
Jawira Portugal 2019-10-02 22:50:58 +02:00 committed by GitHub
commit 71c5397ec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 3217 additions and 117 deletions

9
.idea/phing.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhingConfiguration">
<buildFilePaths>
<buildFile path="file://$PROJECT_DIR$/build.xml" />
</buildFilePaths>
<phingPath>/usr/bin/phing</phingPath>
</component>
</project>

View File

@ -11,6 +11,10 @@
## Unreleased ## Unreleased
### Added
- [#1] Added catalog with the list of all emojis
## [v1.0.0] - 2019-10-01 ## [v1.0.0] - 2019-10-01
### Added ### Added
@ -25,10 +29,12 @@
- [#2] Constant `Emoji::FLAG_WALES` was changed to `Emoji::FLAG_GBWLS`. - [#2] Constant `Emoji::FLAG_WALES` was changed to `Emoji::FLAG_GBWLS`.
## [v0.0.0] - 2019-08-30 ## [v0.0.0] - 2019-08-30
[!6F(t#}P9Uyq&98
### Added ### Added
- First working version. - First working version.
[#2]: https://github.com/jawira/emoji-catalo/pull/2 [#2]: https://github.com/jawira/emoji-catalo/pull/2
[v1.0.0]: https://github.com/jawira/emoji-catalo/compare/v0.0.0...v1.0.0 [v1.0.0]: https://github.com/jawira/emoji-catalo/compare/v0.0.0...v1.0.0
[#1]: https://github.com/jawira/emoji-catalo/pull/1

View File

@ -9,6 +9,8 @@ Features:
- 🤩 A lot of emojis - 🤩 A lot of emojis
- 🔓 Zero dependencies - 🔓 Zero dependencies
You can see [full list of emojis].
[![Latest Stable Version](https://poser.pugx.org/jawira/emoji-catalog/v/stable)](https://packagist.org/packages/jawira/emoji-catalog) [![Latest Stable Version](https://poser.pugx.org/jawira/emoji-catalog/v/stable)](https://packagist.org/packages/jawira/emoji-catalog)
![Emoji](https://img.shields.io/badge/Emoji-v12.0-%235354FE) ![Emoji](https://img.shields.io/badge/Emoji-v12.0-%235354FE)
[![Total Downloads](https://poser.pugx.org/jawira/emoji-catalog/downloads)](https://packagist.org/packages/jawira/emoji-catalog) [![Total Downloads](https://poser.pugx.org/jawira/emoji-catalog/downloads)](https://packagist.org/packages/jawira/emoji-catalog)
@ -55,12 +57,12 @@ License
This library is licensed under the [MIT license](LICENSE.md). This library is licensed under the [MIT license](LICENSE.md).
[GitHub]: https://github.com/jawira/emoji-catalog [GitHub]: https://github.com/jawira/emoji-catalog
[full list of emojis]: https://github.com/jawira/emoji-catalog/blob/master/docs/catalog.md
*** ***
My other packages Packages from jawira
----------------- --------------------
<dl> <dl>
@ -70,19 +72,11 @@ My other packages
Upper case, Lower case, Sentence case, Title case and Dot notation. Upper case, Lower case, Sentence case, Title case and Dot notation.
</dd> </dd>
<dt><a href="https://packagist.org/packages/jawira/phing-visualizer">jawira/phing-visualizer</a> (library)</dt>
<dd>Graphical representation of Phing's buildfile.</dd>
<dt><a href="https://packagist.org/packages/jawira/phing-open-task">jawira/phing-open-task</a> (library)</dt>
<dd>Phing task to open files, directories, and URLs with your favorite software.</dd>
<dt><a href="https://packagist.org/packages/jawira/plantuml">jawira/plantuml</a> (library)</dt> <dt><a href="https://packagist.org/packages/jawira/plantuml">jawira/plantuml</a> (library)</dt>
<dd>Provides PlantUML integration: plantuml executable and plantuml.jar</dd> <dd>Provides PlantUML integration: plantuml executable and plantuml.jar</dd>
<dt><a href="https://packagist.org/packages/jawira/plantuml-encoding">jawira/plantuml-encoding</a> (library)</dt> <dt><a href="https://packagist.org/packages/jawira/plantuml-encoding">jawira/plantuml-encoding</a> (library)</dt>
<dd>PlantUML encoding functions.</dd> <dd>PlantUML encoding functions.</dd>
<dt><a href="https://packagist.org/packages/jawira/process-maker">jawira/process-maker</a> (project)</dt> <dt><a href="https://packagist.org/packages/jawira/">more...</a></dt>
<dd>Easily install and try ProcessMaker using Docker Compose.</dd>
</dl> </dl>

BIN
build.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<project name="Emoji catalog" default="diagnostics"> <project name="Emoji catalog" default="diagnostics" phingVersion="3">
<defaultexcludes default="true"/><!--Initializing default excludes--> <defaultexcludes default="true"/><!--Initializing default excludes-->
<defaultexcludes add="**/.idea"/> <defaultexcludes add="**/.idea"/>
@ -13,7 +13,10 @@
<target name="setup" description="Prepare project for dev" depends="diagnostics, composer:install, phing:visualizer"/> <target name="setup" description="Prepare project for dev" depends="diagnostics, composer:install, phing:visualizer"/>
<target name="qa" description="Quality assurance" depends="composer:validate, php:lint"/> <target name="qa" description="Quality assurance" depends="composer:validate, php:lint"/>
<target name="update" description="Update Emoji.php" depends="emoji:download, emoji:parse, emoji:build"/> <target name="update" description="Update class and catalog" depends="emoji:update, catalog:update"/>
<target name="emoji:update" description="Update Emoji.php" depends="emoji-list:download, emoji:parse, emoji:build"/>
<target name="catalog:update" description="Update catalog.md"
depends="emoji-list:download, catalog:parse, catalog:build"/>
<target name="composer:validate" description="Validate composer.json"> <target name="composer:validate" description="Validate composer.json">
<composer command="validate"> <composer command="validate">
@ -56,7 +59,7 @@
</composer> </composer>
</target> </target>
<target name="emoji:download"> <target name="emoji-list:download">
<mkdir dir="resources/unicode/"/> <mkdir dir="resources/unicode/"/>
<httpget dir="resources/unicode/" url="https://unicode.org/emoji/charts/full-emoji-list.html"/> <httpget dir="resources/unicode/" url="https://unicode.org/emoji/charts/full-emoji-list.html"/>
<httpget dir="resources/unicode/" url="https://unicode.org/emoji/charts/full-emoji-modifiers.html"/> <httpget dir="resources/unicode/" url="https://unicode.org/emoji/charts/full-emoji-modifiers.html"/>
@ -64,17 +67,17 @@
<target name="emoji:parse"> <target name="emoji:parse">
<mkdir dir="resources/output"/> <mkdir dir="resources/output"/>
<delete file="resources/output/full-emoji-list.txt"/> <delete file="resources/output/emoji-1.txt"/>
<xslt file="resources/unicode/full-emoji-list.html" <xslt file="resources/unicode/full-emoji-list.html"
tofile="resources/output/full-emoji-list.txt" tofile="resources/output/emoji-1.txt"
style="resources/xslt/emoji.xsl" style="resources/xslt/emoji.xsl"
haltonerror="false" haltonerror="false"
overwrite="true" overwrite="true"
html="true"/> html="true"/>
<delete file="resources/output/full-emoji-modifiers.txt"/> <delete file="resources/output/emoji-2.txt"/>
<xslt file="resources/unicode/full-emoji-modifiers.html" <xslt file="resources/unicode/full-emoji-modifiers.html"
tofile="resources/output/full-emoji-modifiers.txt" tofile="resources/output/emoji-2.txt"
style="resources/xslt/emoji.xsl" style="resources/xslt/emoji.xsl"
haltonerror="false" haltonerror="false"
overwrite="true" overwrite="true"
@ -82,10 +85,36 @@
</target> </target>
<target name="emoji:build"> <target name="emoji:build">
<append file="resources/templates/header.php.dist" destFile="src/Emoji.php" append="false" overwrite="true"/> <append file="resources/templates/emoji-header.php.dist" destFile="src/Emoji.php" append="false" overwrite="true"/>
<append file="resources/output/full-emoji-list.txt" destFile="src/Emoji.php"/> <append file="resources/output/emoji-1.txt" destFile="src/Emoji.php"/>
<append file="resources/output/full-emoji-modifiers.txt" destFile="src/Emoji.php"/> <append file="resources/output/emoji-2.txt" destFile="src/Emoji.php"/>
<append file="resources/templates/footer.php.dist" destFile="src/Emoji.php"/> <append file="resources/templates/emoji-footer.php.dist" destFile="src/Emoji.php"/>
</target>
<target name="catalog:parse">
<mkdir dir="resources/output"/>
<delete file="resources/output/catalog-1.txt"/>
<xslt file="resources/unicode/full-emoji-list.html"
tofile="resources/output/catalog-1.txt"
style="resources/xslt/catalog.xsl"
haltonerror="false"
overwrite="true"
html="true"/>
<delete file="resources/output/catalog-2.txt"/>
<xslt file="resources/unicode/full-emoji-modifiers.html"
tofile="resources/output/catalog-2.txt"
style="resources/xslt/catalog.xsl"
haltonerror="false"
overwrite="true"
html="true"/>
</target>
<target name="catalog:build">
<append file="resources/templates/catalog-header.md.dist" destFile="docs/catalog.md" append="false"
overwrite="true"/>
<append file="resources/output/catalog-1.txt" destFile="docs/catalog.md"/>
<append file="resources/output/catalog-2.txt" destFile="docs/catalog.md"/>
</target> </target>
<target name="php:lint" description="Check PHP syntax"> <target name="php:lint" description="Check PHP syntax">

3026
docs/catalog.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
Catalog
=======
This list contains all the _emojis_ from `\Jawira\EmojiCatalog\Emoji`.
| Name | Emoji | Code point(s) | `\Jawira\EmojiCatalog\Emoji::`
| --------- | --------- | ------------- | -------------------------------

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" version="2.0" encoding="UTF-8" indent="no"/>
<xsl:include href="./resources/xslt/common.xsl"/>
<xsl:template match="/">
<xsl:for-each select="//table//tr[./td//img]">
<xsl:text>| </xsl:text>
<xsl:call-template name="get-name"/>
<xsl:text> </xsl:text>
<xsl:text>| </xsl:text>
<xsl:call-template name="get-emoji"/>
<xsl:text> </xsl:text>
<xsl:text>| </xsl:text>
<xsl:call-template name="get-code"/>
<xsl:text> </xsl:text>
<xsl:text>| </xsl:text>
<xsl:call-template name="get-constant-name"/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

95
resources/xslt/common.xsl Normal file
View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="get-code">
<xsl:value-of select="./td[2]//a/text()"/>
</xsl:template>
<xsl:template name="get-name">
<xsl:variable name="short-name" select="./td[last()]/text()"/>
<xsl:variable name="removable" select="'⊛⊖'"/>
<xsl:variable name="cleaned" select="translate($short-name, $removable, '')"/>
<xsl:value-of select="normalize-space($cleaned)"/>
</xsl:template>
<xsl:template name="get-emoji">
<xsl:value-of select="./td[3]/text()"/>
</xsl:template>
<xsl:template name="get-constant-name">
<xsl:variable name="short-name" select="./td[last()]/text()"/>
<xsl:variable name="removable" select="':;.,⊛’!“”()⊖'"/>
<xsl:variable name="cleaned" select="translate($short-name, $removable, '')"/>
<xsl:variable name="lowercase" select="'Åãabcçdeéfghíijklmnoôpqrstuvwxyz-&amp;'"/>
<xsl:variable name="uppercase" select="'AAABCCDEEFGHIIJKLMNOOPQRSTUVWXYZ N'"/>
<xsl:variable name="no-accents" select="translate($cleaned, $lowercase, $uppercase)"/>
<xsl:variable name="normalized" select="normalize-space($no-accents)"/>
<xsl:variable name="no-spaces" select="translate($normalized, ' ', '_')"/>
<xsl:variable name="no-1st">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-spaces"/>
<xsl:with-param name="replace" select="'1ST'"/>
<xsl:with-param name="by" select="'FIRST'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="no-2nd">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-1st"/>
<xsl:with-param name="replace" select="'2ND'"/>
<xsl:with-param name="by" select="'SECOND'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="no-3rd">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-2nd"/>
<xsl:with-param name="replace" select="'3RD'"/>
<xsl:with-param name="by" select="'THIRD'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="no-number">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-3rd"/>
<xsl:with-param name="replace" select="'#'"/>
<xsl:with-param name="by" select="'NUMBER'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="no-asterisk">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-number"/>
<xsl:with-param name="replace" select="'*'"/>
<xsl:with-param name="by" select="'ASTERISK'"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$no-asterisk"/>
</xsl:template>
<!-- http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx -->
<xsl:template name="string-replace-all">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="by"/>
<xsl:choose>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$by"/>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="by" select="$by"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" version="2.0" encoding="UTF-8" indent="no"/> <xsl:output method="text" version="2.0" encoding="UTF-8" indent="no"/>
<xsl:include href="./resources/xslt/common.xsl"/>
<xsl:template match="/"> <xsl:template match="/">
<xsl:for-each select="//table//tr[./td//img]"> <xsl:for-each select="//table//tr[./td//img]">
@ -17,100 +18,9 @@
<xsl:text> const </xsl:text> <xsl:text> const </xsl:text>
<xsl:call-template name="get-constant-name"/> <xsl:call-template name="get-constant-name"/>
<xsl:text> = "</xsl:text> <xsl:text> = "</xsl:text>
<xsl:call-template name="get-alt"/> <xsl:call-template name="get-emoji"/>
<xsl:text>";&#10;&#10;</xsl:text> <xsl:text>";&#10;&#10;</xsl:text>
</xsl:for-each> </xsl:for-each>
</xsl:template> </xsl:template>
<xsl:template name="get-code">
<xsl:value-of select="./td[2]//a/text()"/>
</xsl:template>
<xsl:template name="get-name">
<xsl:variable name="short-name" select="./td[last()]/text()"/>
<xsl:variable name="removable" select="'⊛⊖'"/>
<xsl:variable name="cleaned" select="translate($short-name, $removable, '')"/>
<xsl:value-of select="normalize-space($cleaned)"/>
</xsl:template>
<xsl:template name="get-alt">
<xsl:value-of select="./td[3]/text()"/>
</xsl:template>
<xsl:template name="get-constant-name">
<xsl:variable name="short-name" select="./td[last()]/text()"/>
<xsl:variable name="removable" select="':;.,⊛’!“”()⊖'"/>
<xsl:variable name="cleaned" select="translate($short-name, $removable, '')"/>
<xsl:variable name="lowercase" select="'Åãabcçdeéfghíijklmnoôpqrstuvwxyz-&amp;'"/>
<xsl:variable name="uppercase" select="'AAABCCDEEFGHIIJKLMNOOPQRSTUVWXYZ N'"/>
<xsl:variable name="no-accents" select="translate($cleaned, $lowercase, $uppercase)"/>
<xsl:variable name="normalized" select="normalize-space($no-accents)"/>
<xsl:variable name="no-spaces" select="translate($normalized, ' ', '_')"/>
<xsl:variable name="no-1st">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-spaces"/>
<xsl:with-param name="replace" select="'1ST'"/>
<xsl:with-param name="by" select="'FIRST'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="no-2nd">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-1st"/>
<xsl:with-param name="replace" select="'2ND'"/>
<xsl:with-param name="by" select="'SECOND'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="no-3rd">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-2nd"/>
<xsl:with-param name="replace" select="'3RD'"/>
<xsl:with-param name="by" select="'THIRD'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="no-number">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-3rd"/>
<xsl:with-param name="replace" select="'#'"/>
<xsl:with-param name="by" select="'NUMBER'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="no-asterisk">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$no-number"/>
<xsl:with-param name="replace" select="'*'"/>
<xsl:with-param name="by" select="'ASTERISK'"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$no-asterisk"/>
</xsl:template>
<!-- http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx -->
<xsl:template name="string-replace-all">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="by"/>
<xsl:choose>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$by"/>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="by" select="$by"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>