Skip to content

Commit

Permalink
use english as default language in sTeX
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazzpirate committed Nov 17, 2023
1 parent 4d1f8c8 commit 91926a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ trait SHTMLDocumentServer { this : STeXServer =>
protected case class DocParams(q: WebQuery) {
lazy val path = q.pairs.find(p => p._2.isEmpty && p._1.contains('?') && !p._1.endsWith("="))
.map(p => Path.parse(p._1))
lazy val language = q("language").orElse(context_filepath.flatMap(parseLanguage))
lazy val language = q("language").getOrElse(context_filepath.flatMap(parseLanguage).getOrElse("en"))
lazy val archive = q("archive").flatMap{id => getArchive(id)}
lazy val filepath = q("filepath")
lazy val bindings = {
Expand Down Expand Up @@ -460,7 +460,7 @@ trait SHTMLDocumentServer { this : STeXServer =>
}

def doDeclHeader(c: Constant)(implicit dp:DocParams) = {
val state = new OMDocState(dp.language.getOrElse("en"))
val state = new OMDocState(dp.language)
doSymbol(c)(state).toString()
}

Expand Down Expand Up @@ -555,7 +555,7 @@ trait SHTMLDocumentServer { this : STeXServer =>
}

def getAllFragmentsDefault(c : Constant)(implicit dp:DocParams) : List[(String,String)] = {
SHTMLContentManagement.getSymdocs(c.path, dp.language.getOrElse("en"),dp.context_doc)(controller) match { // TODO language
SHTMLContentManagement.getSymdocs(c.path, dp.language,dp.context_doc)(controller) match { // TODO language
case Nil =>
val res = "Symbol <b>" + c.name + "</b> in module " + (SourceRef.get(c) match {
case Some(sr) =>
Expand Down Expand Up @@ -583,16 +583,12 @@ trait SHTMLDocumentServer { this : STeXServer =>
}

def sort(defs:List[(GlobalName,Node)])(implicit dp:DocParams): List[(GlobalName,Node)] = {
dp.language match {
case None => defs
case Some(lang) =>
val ls = defs.filter(_._1.module.name.toString == lang)
if (ls.isEmpty) defs else (ls ::: defs).distinct
}
val ls = defs.filter(_._1.module.name.toString == dp.language)
if (ls.isEmpty) defs else (ls ::: defs).distinct
}

def getFragmentDefault(c : Constant)(implicit dp:DocParams) : String = {
SHTMLContentManagement.getSymdocs(c.path,dp.language.getOrElse("en"),dp.context_doc)(controller) match { // TODO language TODO sort by relevance
SHTMLContentManagement.getSymdocs(c.path,dp.language,dp.context_doc)(controller) match { // TODO language TODO sort by relevance
case Nil =>
val res = "Symbol <b>" + c.name + "</b> in module " + (SourceRef.get(c) match {
case Some(sr) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ trait ExportExtension { self : STeXServer =>
private def doFile(file:File,to:File,top : Boolean = false,withbindings:Option[LateBinding])(implicit state:ExportState): Unit = {
val params = new DocParams(new WebQuery(Nil)) {
override lazy val path = None
override lazy val language = None // TODO
override lazy val language = "en" // TODO
override lazy val filepath = Some(file.setExtension("xhtml").toString)
override lazy val bindings = withbindings
override lazy val archive = Some(state.archive)
Expand All @@ -236,7 +236,7 @@ trait ExportExtension { self : STeXServer =>
case Some(c : Constant) =>
implicit val params = new DocParams(new WebQuery(Nil)) {
override lazy val path = Some(gn)
override lazy val language = None // TODO
override lazy val language = "en" // TODO
override lazy val filepath = None
override lazy val bindings = None
override lazy val archive = Some(state.archive)
Expand All @@ -263,7 +263,7 @@ trait ExportExtension { self : STeXServer =>
case Some(c: Constant) =>
implicit val params = new DocParams(new WebQuery(Nil)) {
override lazy val path = Some(gn)
override lazy val language = None // TODO
override lazy val language = "en" // TODO
override lazy val filepath = None
override lazy val bindings = None
override lazy val archive = Some(state.archive)
Expand Down

0 comments on commit 91926a3

Please sign in to comment.