-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preprocessing of markdown files for docs.scala-lang
- Loading branch information
1 parent
deaa6c1
commit 03aadc2
Showing
21 changed files
with
431 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!--- This file is copied from dotty repo located at the github lampepefl/dotty inside docs/docsScalaLangResources/scaladoc-assets.html --> | ||
<script src="{{ site.baseurl }}/scripts/scaladoc-scalajs.js" type="text/javascript"></script> | ||
<link rel="stylesheet" href="{{ site.baseurl }}/resources/css/colors.css" type="text/css" /> | ||
<link rel="stylesheet" href="{{ site.baseurl }}/resources/css/code-snippets.css" type="text/css" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
shopt -s extglob # needed for rm everything but x | ||
echo "Working directory: $PWD" | ||
|
||
GENDOC_EXTRA_ARGS=$@ | ||
GIT_HEAD=$(git rev-parse HEAD) # save current head for commit message in gh-pages | ||
PREVIOUS_SNAPSHOTS_DIR="$PWD/../prev_snapshots" | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >& /dev/null && pwd)" | ||
SITE_OUT_DIR="$PWD/docs/_site" | ||
|
||
DOCS_SCALA_LANG_DIR="$PWD/docsScalaLang" | ||
|
||
rm -rf $DOCS_SCALA_LANG_DIR | ||
mkdir -pv $DOCS_SCALA_LANG_DIR | ||
git clone "https://github.com/scala/docs.scala-lang.git" $DOCS_SCALA_LANG_DIR | ||
|
||
SBT="$SCRIPT_DIR/sbt" | ||
mkdir -pv $SITE_OUT_DIR | ||
env "scaladoc.projectFormat=md" "$SBT" "scaladoc/renderScaladocScalajsToFile $DOCS_SCALA_LANG_DIR/scripts/scaladoc-scalajs.js $DOCS_SCALA_LANG_DIR/resources/css code-snippets.css" | ||
"dist/target/pack/bin/scaladoc" "-d" "$SITE_OUT_DIR" "-format" "md" "-siteroot" "docs" "/dev/null" | ||
|
||
if [ ! -d "$SITE_OUT_DIR" ]; then | ||
echo "Output directory did not exist: $SITE_OUT_DIR" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# Copy reference and scaladoc docs | ||
cp -rf "$SITE_OUT_DIR/docs/reference"/* "$DOCS_SCALA_LANG_DIR/_scala3-reference" | ||
cp -rf "$SITE_OUT_DIR/docs/usage/scaladoc"/* "$DOCS_SCALA_LANG_DIR/_overviews/scala3-scaladoc" | ||
|
||
cp -rf "$SITE_OUT_DIR/docs/reference/contextual/motivation.md" "$DOCS_SCALA_LANG_DIR/_scala3-reference/contextual.md" | ||
cp -rf "$SITE_OUT_DIR/docs/reference/metaprogramming/toc.md" "$DOCS_SCALA_LANG_DIR/_scala3-reference/metaprogramming.md" | ||
cp -rf "$SITE_OUT_DIR/docs/resources/talks.md" "$DOCS_SCALA_LANG_DIR/scala3/talks.md" | ||
cp -rf "$SITE_OUT_DIR/docs/usage/getting-started.md" "$DOCS_SCALA_LANG_DIR/scala3/getting-started.md" | ||
cp -rf "$SITE_OUT_DIR/docs/usage/language-versions.md" "$DOCS_SCALA_LANG_DIR/_scala3-reference/language-versions.md" | ||
cp -rf "$SITE_OUT_DIR/docs/usage/worksheet-mode.md" "$DOCS_SCALA_LANG_DIR/_overviews/scala3-book/tools-worksheets.md" | ||
|
||
|
||
# Copy csses and html importing these assets | ||
cp -f "$SITE_OUT_DIR/styles/colors.css" "$DOCS_SCALA_LANG_DIR/resources/css/colors.css" | ||
cp -f "$PWD/docs/docsScalaLangResources/scaladoc-assets.html" "$DOCS_SCALA_LANG_DIR/_includes/scaladoc-assets.html" | ||
|
||
# Hack inclusion of these assests by the docs.scala-lang jekyll builder | ||
echo "{% include scaladoc-assets.html %}" >> "$DOCS_SCALA_LANG_DIR/_layouts/inner-page-parent-dropdown.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
package dotty.tools.scaladoc | ||
|
||
object Main extends App { | ||
Searchbar() | ||
SocialLinks() | ||
CodeSnippets() | ||
DropdownHandler() | ||
Ux() | ||
} | ||
object Main: | ||
|
||
private def common(): Unit = | ||
CodeSnippets() | ||
|
||
def main(): Unit = | ||
Searchbar() | ||
SocialLinks() | ||
DropdownHandler() | ||
Ux() | ||
common() | ||
|
||
/** | ||
* This main is conditionally enabled by system env variable `scaladoc.projectFormat=md` | ||
* passed in ./projects/scripts/genDocsScalaLang | ||
* The reason why we have to pass the condition by env variable is because js is build before scaladoc, | ||
* so we cannot access its args | ||
*/ | ||
def markdownMain(): Unit = | ||
common() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.