Skip to content

Commit

Permalink
Added docfx documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
zedseven committed Oct 20, 2020
1 parent 5152d94 commit 302df48
Show file tree
Hide file tree
Showing 21 changed files with 933 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,15 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/


# Project-Specific
Documentation/**/DROP/
Documentation/**/TEMP/
Documentation/**/packages/
Documentation/**/bin/
Documentation/**/obj/
Documentation/generated/
Documentation/api/.gitignore
Documentation/api/*.yml
Documentation/api/.manifest
22 changes: 20 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,26 @@ script:
- dotnet test RomanizationTests/RomanizationTests.csproj

deploy:
skip_cleanup: true
provider: script
script: chmod +x ./deploy.sh && bash ./deploy.sh $NUGET_API_KEY $NUGET_SOURCE $GH_PACKAGES_API_KEY $GH_PACKAGES_SOURCE
skip_cleanup: true
script: chmod +x ./Scripts/deploy.sh && bash ./Scripts/deploy.sh $NUGET_API_KEY $NUGET_SOURCE $GH_PACKAGES_API_KEY $GH_PACKAGES_SOURCE
on:
branch: main

# https://stackoverflow.com/a/33125422/6003488
after_success:
- | if [ -n "$GITHUB_API_KEY" ]; then
cd "$TRAVIS_BUILD_DIR"
cd Documentation/generated
git init
git checkout -b gh-pages
cd ../..
chmod +x ./Scripts/buildDoc.sh && bash ./Scripts/buildDoc.sh
cd Documentation/generated
git add .
git -c user.name='travisci' -c user.email='travisci' commit -m "Updating Pages with updated documentation."
# Make sure to make the output quiet, or else the API token will leak!
# This works because the API key can replace your password.
git push -f -q https://zedseven:[email protected]/zedseven/Romanization.NET-gh-pages gh-pages &>/dev/null
cd "$TRAVIS_BUILD_DIR"
fi
2 changes: 2 additions & 0 deletions Documentation/api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# API Documentation
Please select a namespace or class on the left.
7 changes: 7 additions & 0 deletions Documentation/articles/readingsSystems.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Readings Systems
A readings system is a romanization system implemented in such a way that instead of being limited to yielding just one romanization value for a character, can return every known reading for every single character.

This is a package-specific detail, but it allows you to do with the readings how you please. If you'd rather just get *a* reading, these systems still support the basic [Process](/api/Romanization.IRomanizationSystem.html#Romanization_IRomanizationSystem_Process_System_String_)
function.

If you're looking for the API Documentation for them, you can find it [here](/api/Romanization.IReadingsRomanizationSystem-1.html).
73 changes: 73 additions & 0 deletions Documentation/articles/supported.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Supported Languages and Systems
The goal of Romanization.NET is to provide a simple, extensive way to romanize widely-used languages as accurately as possible.

Below is a list of all supported languages and systems, with explanations of caveats and limitations if necessary.



## Chinese
### [Hànyǔ Pīnyīn](https://en.wikipedia.org/wiki/Pinyin)
The Hànyǔ Pīnyīn system is considered a [Readings System](readingsSystems.md), and supports all [Hànzì](https://en.wikipedia.org/wiki/Chinese_characters) characters in the [Unihan database](http://www.unicode.org/charts/unihan.html).

The [reading types](/api/Romanization.Chinese.HanyuPinyinSystem.ReadingTypes.html) to use can be specified, but default to using all of them.

The order in which readings are returned is as follows:
1. Hànyǔ Pīnyīn
2. Hànyǔ Pínlǜ - Hànyǔ Pīnyīn as it appeared in [Xiàndài Hànyǔ Pínlǜ Cídiǎn](https://www.unicode.org/reports/tr38/index.html#kHanyuPinlu)
3. XHC - Hànyǔ Pīnyīn as it appeared in [Xiàndài Hànyǔ Cídiǎn](https://www.unicode.org/reports/tr38/index.html#kXHC1983)



## Japanese
### [Modified Hepburn](https://en.wikipedia.org/wiki/Hepburn_romanization)
This system is a revised version of the romanization system first published by James Curtis Hepburn, and the one in most widespread use in Japan.

It only supports [kana](https://en.wikipedia.org/wiki/Kana) ([hiragana](https://en.wikipedia.org/wiki/Hiragana) and [katakana](https://en.wikipedia.org/wiki/Katakana)), not Kanji. See below for Kanji support.

This supports [syllabic n](https://en.wikipedia.org/wiki/Hepburn_romanization#Syllabic_n) (ん), [long consonants](https://en.wikipedia.org/wiki/Hepburn_romanization#Long_consonants) (sokuon, or っ), and [long vowels](https://en.wikipedia.org/wiki/Hepburn_romanization#Loanwords) (chōonpu (ー) only).

#### Limitations
In the Modified Hepburn system, certain pairs of subsequent vowels in the romanized result are [to be combined into single long vowels](https://en.wikipedia.org/wiki/Hepburn_romanization#Long_vowels), often indicated with a macron (aa => ā, for example).

The issue is, according to the spec for the system, these combinations depend on whether the two vowels belong to different morphemes - this is not something known to the program.
As a result, while some vowel combinations *could* be done (not all have this requirement), to remain consistent in output, no vowel combination is done.


### [Kanji (Kun & On) Readings](https://en.wikipedia.org/wiki/Kanji#Readings)
Kanji are effectively Japan's Hànzì, and share many of the same considerations and even symbols.

While kana are syllabaries (each character is one syllable, and therefore maps neatly to a distinct sound), Kanji are their own symbols that can be a variable number of syllables.
To make things more complicated, each can have multiple readings - in both [Kun'yomi](https://en.wikipedia.org/wiki/Kanji#Kun'yomi_(native_reading)) and [On'yomi](https://en.wikipedia.org/wiki/Kanji#On'yomi_(Sino-Japanese_reading)).

This is why this system is considered a [Readings System](readingsSystems.md) for the purposes of this library, which means you can get every known reading from the [Unihan database](http://www.unicode.org/charts/unihan.html) for each character.

The two reading types supported are:
1. Kun'yomi - often referred to as just Kun - the native reading
2. On'yomi - often referred to as just On - the Sino-Japanese reading

#### Additional Notes
Because Kanji often appear alongside supplementary kana, the system also has a small convenience function that romanizes both Kanji and Kana, using the system of your choice for kana.



## Korean
### [Revised Romanization of Korean](https://en.wikipedia.org/wiki/Revised_Romanization_of_Korean)
The Revised Romanization of Korean system is the most commonly used, and does not make use of accents or macrons.

The system has a few provisions for certain kinds of content, which change the romanization somewhat:
- Certain special pairs of jamo are not combined in given names
- Whether or not aspiration is reflected in the romanization depends on whether or not the word is a noun
- Sometimes it can be helpful to hyphenate syllables, which occassionally makes a difference in disambiguating words with the same romanization (ga-eul vs. gae-ul)

The library's implementation of this system supports all of these provisions as options that can be supplied to the function.


### [Hanja](https://en.wikipedia.org/wiki/Hanja) => [Hangeul](https://en.wikipedia.org/wiki/Hangul) Readings
Hanja, like Kanji, came from China and share their symbols with Hànzì. As a result, this is also considered a [Readings System](readingsSystems.md) as some Hanja have multiple possible readings.

As with the other Hànzì-related characters, the supported Hanja are all from the [Unihan database](http://www.unicode.org/charts/unihan.html).

Only one reading type is supported, which is the Hangeul equivalent pronunciation for each Hanja character.

#### Additional Notes
Because the goal of this package is, as the name suggests, romanization, the implementation also includes a function for first converting the Hanja to Hangeul, then romanizing the Hangeul using the system of your choice.
4 changes: 4 additions & 0 deletions Documentation/articles/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Supported Languages
href: supported.md
- name: Reading Systems
href: readingsSystems.md
70 changes: 70 additions & 0 deletions Documentation/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// `View Source` link seems to be missing because of: https://github.com/dotnet/docfx/issues/1439
{
"metadata": [
{
"src": [
{
"files": [
"**/**.csproj"
],
"exclude": [
"**/**Tests.csproj"
],
"src": ".."
}
],
"dest": "api",
"disableGitFeatures": false,
"disableDefaultFilter": false
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
".site/**"
]
}
],
"dest": "generated",
"globalMetadataFiles": [ "globalMetadata.json" ],
"fileMetadataFiles": [],
"template": [
"default"
/*"templates/docfx-tmpl"*/
],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": true,
"disableGitFeatures": false
}
}
9 changes: 9 additions & 0 deletions Documentation/globalMetadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// https://dotnet.github.io/docfx/tutorial/docfx.exe_user_manual.html#322-reserved-metadata
{
"_appTitle": "Romanization.NET",
"_appFooter": "Romanization.NET",
"_enableSearch": "true",
"_enableNewTab": true,
"_disableContribution": "false",
"_disableAffix": false
}
38 changes: 38 additions & 0 deletions Documentation/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Romanization.NET
Welcome to Romanization.NET! This is a library for romanizing (converting to the latin alphabet) languages and writing systems that use different alphabets.

## Getting Started
Below is a brief example of how you might use the library to romanize some Korean Hangeul text:
```csharp
using Romanization;
...
string romanizedText = Korean.RevisedRomanization.Value.Process("한글");
Console.WriteLine(romanizedText);
// Outputs: han-geul
```

Every language system is lazily initialized - this means only the romanization systems you use will be loaded.

To see all available languages and systems as well as implementation details and further options, please visit the [API Documentation](/api).

## Installation
Because it is [available on NuGet.org](https://www.nuget.org/packages/Romanization.NET/), you can install it in any typical way you install any other NuGet package.

If you'd rather install it manually, the package is also available on [GitHub Packages](https://github.com/zedseven?tab=packages&repo_name=Romanization.NET).

### Command Line
To get started, just use:
```
dotnet add package Romanization.NET
```

Or in the Package Manager Console:
```
Install-Package Romanization.NET
```

### Visual Studio UI
You can also install through `Tools > NuGet Package Manager > Manage NuGet Packages for Solution...`, and search `Romanization.NET`.

## More Information
For more detailed information about the package and what it supports, please visit the [Articles Section](/articles/supported.html).
1 change: 1 addition & 0 deletions Documentation/templates/docfx-tmpl/link.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/MathewSachin/docfx-tmpl
17 changes: 17 additions & 0 deletions Documentation/templates/docfx-tmpl/partials/affix.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{^_disableContribution}}
<div class="contribution-panel mobile-hide">
{{#docurl}}
<a href="{{docurl}}" title="{{__global.improveThisDoc}}" class="fab btn-warning pull-right"><i class="glyphicon glyphicon-pencil"></i></a>
{{/docurl}}
{{#sourceurl}}
<a href="{{sourceurl}}" title="{{__global.viewSource}}" class="fab btn-info pull-right"><i class="fa fa-code"></i></a>
{{/sourceurl}}
</div>
{{/_disableContribution}}

<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
</nav>
</div>
</div>
100 changes: 100 additions & 0 deletions Documentation/templates/docfx-tmpl/partials/class.header.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<h1 id="{{id}}" data-uid="{{uid}}">{{>partials/title}}</h1>
<div class="markdown level0 summary">{{{summary}}}</div>
<div class="markdown level0 conceptual">{{{conceptual}}}</div>

{{#inClass}}
<div class="inheritance">
<h5>{{__global.inheritance}}</h5>
{{#inheritance}}
<div class="level{{index}}">{{{specName.0.value}}}</div>
{{/inheritance}}
<div class="level{{level}}"><span class="xref">{{name.0.value}}</span></div>
</div>
{{/inClass}}

{{#derivedClasses}}
<div class="level{{index}}">{{{specName.0.value}}}</div>
{{/derivedClasses}}

{{#inheritedMembers.0}}
<div class="inheritedMembers">
<h5>{{__global.inheritedMembers}}</h5>
{{/inheritedMembers.0}}
{{#inheritedMembers}}
<div>
{{#definition}}
<xref uid="{{definition}}" text="{{nameWithType.0.value}}" alt="{{fullName.0.value}}"/>
{{/definition}}
{{^definition}}
<xref uid="{{uid}}" text="{{nameWithType.0.value}}" alt="{{fullName.0.value}}"/>
{{/definition}}
</div>
{{/inheritedMembers}}
{{#inheritedMembers.0}}
</div>
{{/inheritedMembers.0}}

<h6><strong>{{__global.namespace}}</strong>: {{{namespace.specName.0.value}}}</h6>
<h6><strong>{{__global.assembly}}</strong>: {{assemblies.0}}.dll</h6>

<h5 id="{{id}}_syntax">{{__global.syntax}}</h5>
<div class="codewrapper">
<pre><code class="lang-{{_lang}} hljs">{{syntax.content.0.value}}</code></pre>
</div>

{{#syntax.parameters.0}}
<h5 class="parameters">{{__global.parameters}}</h5>
<table>
{{/syntax.parameters.0}}
{{#syntax.parameters}}
<tr>
<td>
<span class="pull-right">{{{type.specName.0.value}}}</span>
<span class="parametername">{{{id}}}</span>
<p>{{{description}}}</p>
</td>
</tr>
{{/syntax.parameters}}
{{#syntax.parameters.0}}
</table>
{{/syntax.parameters.0}}

{{#syntax.return}}
<h5 class="returns">{{__global.returns}}</h5>
<table>
<tr>
<td>
{{{type.specName.0.value}}}
<p>{{{description}}}</p>
</td>
</tr>
</table>
{{/syntax.return}}

{{#syntax.typeParameters.0}}
<h5 class="typeParameters">{{__global.typeParameters}}</h5>
<table>
{{/syntax.typeParameters.0}}
{{#syntax.typeParameters}}
<tr>
<td>
<span class="parametername">{{{id}}}</span>
<p>{{{description}}}</p>
</td>
</tr>
{{/syntax.typeParameters}}
{{#syntax.typeParameters.0}}
</table>
{{/syntax.typeParameters.0}}

{{#remarks}}
<h5 id="{{id}}_remarks"><strong>{{__global.remarks}}</strong></h5>
<div class="markdown level0 remarks">{{{remarks}}}</div>
{{/remarks}}

{{#example.0}}
<h5 id="{{id}}_examples"><strong>{{__global.examples}}</strong></h5>
{{/example.0}}
{{#example}}
{{{.}}}
{{/example}}
Loading

0 comments on commit 302df48

Please sign in to comment.