This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carl Kittelberger
committed
Feb 9, 2017
0 parents
commit fa26623
Showing
23 changed files
with
1,014 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = false | ||
insert_final_newline = true | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = false | ||
|
||
[*.{yaml,yml}] | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true |
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,24 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
workreportmgr | ||
*.exe | ||
*.test |
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,49 @@ | ||
package latex | ||
|
||
import ( | ||
"io" | ||
"text/template" | ||
|
||
"github.com/nicksnyder/go-i18n/i18n" | ||
|
||
"git.dekart811.net/icedream/workreportmgr/project" | ||
) | ||
|
||
// TexMarker represents information about a TeX document to be read in by the | ||
// respective compiler. It contains information for example about which TeX | ||
// variant to use. | ||
type TexMarker struct { | ||
Program string | ||
} | ||
|
||
// Exporter provides functionality to export a workreports project to a LaTeX | ||
// file. | ||
type Exporter struct { | ||
Locale string | ||
Inputs []string | ||
Marker TexMarker | ||
} | ||
|
||
// Export generates LaTeX code from the given project and writes it to the given | ||
// writer. | ||
func (e *Exporter) Export(prj *project.Project, w io.Writer) (err error) { | ||
T, err := i18n.Tfunc(e.Locale) | ||
if err != nil { | ||
return | ||
} | ||
|
||
exportTemplate.Funcs(template.FuncMap{ | ||
"T": T, | ||
}) | ||
|
||
data := struct { | ||
Project *project.Project | ||
TexMarker TexMarker | ||
TexInputs []string | ||
}{ | ||
Project: prj, | ||
TexInputs: e.Inputs, | ||
TexMarker: e.Marker, | ||
} | ||
return exportTemplate.Execute(w, data) | ||
} |
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,6 @@ | ||
package latex | ||
|
||
func init() { | ||
initLocalization() | ||
initTemplate() | ||
} |
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,29 @@ | ||
package latex | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/nicksnyder/go-i18n/i18n" | ||
) | ||
|
||
//go:generate go-bindata -pkg latex -o localization_assets.go localization/ | ||
|
||
func initLocalization() { | ||
log.Println("Initializing localization for LaTeX export...") | ||
|
||
files, err := AssetDir("localization") | ||
if err != nil { | ||
log.Fatal("Failed to browse embedded asset directory.", err) | ||
panic(err) | ||
} | ||
|
||
for _, file := range files { | ||
if localizationBytes, err := Asset("localization/" + file); err != nil { | ||
log.Fatal("Failed to read localization file.", err) | ||
panic(err) | ||
} else if err := i18n.ParseTranslationFileBytes(file, localizationBytes); err != nil { | ||
log.Fatal("Failed to parse localization file.", err) | ||
panic(err) | ||
} | ||
} | ||
} |
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,54 @@ | ||
[ | ||
{ | ||
"id": "calendar_week", | ||
"translation": "Kalenderwoche" | ||
}, | ||
{ | ||
"id": "calendar_week_short", | ||
"translation": "KW" | ||
}, | ||
{ | ||
"id": "department", | ||
"translation": "Abteilung" | ||
}, | ||
{ | ||
"id": "instructor", | ||
"translation": "Ausbilder/in" | ||
}, | ||
{ | ||
"id": "legal_representative", | ||
"translation": "Gesetzlicher Vertreter" | ||
}, | ||
{ | ||
"id": "name", | ||
"translation": "Name" | ||
}, | ||
{ | ||
"id": "no_school_periods_this_week", | ||
"translation": "Hat in dieser Woche noch nicht stattgefunden." | ||
}, | ||
{ | ||
"id": "operational_activities", | ||
"translation": "Betriebliche Tätigkeiten" | ||
}, | ||
{ | ||
"id": "operational_instruction", | ||
"translation": "Betrieblicher Unterricht" | ||
}, | ||
{ | ||
"id": "professional_school", | ||
"translation": "Berufsschule" | ||
}, | ||
{ | ||
"id": "proof_of_education", | ||
"translation": "Ausbildungsnachweis Nr. {{.Count}}" | ||
}, | ||
{ | ||
"id": "trainee", | ||
"translation": "Auszubildende/r" | ||
}, | ||
{ | ||
"id": "time_period", | ||
"translation": "Zeitraum" | ||
} | ||
] |
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 @@ | ||
[] |
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,54 @@ | ||
[ | ||
{ | ||
"id": "calendar_week", | ||
"translation": "Calendar week" | ||
}, | ||
{ | ||
"id": "calendar_week_short", | ||
"translation": "CW" | ||
}, | ||
{ | ||
"id": "department", | ||
"translation": "Department" | ||
}, | ||
{ | ||
"id": "instructor", | ||
"translation": "Instructor" | ||
}, | ||
{ | ||
"id": "legal_representative", | ||
"translation": "Legal representative" | ||
}, | ||
{ | ||
"id": "name", | ||
"translation": "Name" | ||
}, | ||
{ | ||
"id": "no_school_periods_this_week", | ||
"translation": "No school periods this week." | ||
}, | ||
{ | ||
"id": "operational_activities", | ||
"translation": "Operational activities" | ||
}, | ||
{ | ||
"id": "operational_instruction", | ||
"translation": "Operational instruction" | ||
}, | ||
{ | ||
"id": "professional_school", | ||
"translation": "Professional school" | ||
}, | ||
{ | ||
"id": "proof_of_education", | ||
"translation": "Proof of Education No. {{.Count}}" | ||
}, | ||
{ | ||
"id": "trainee", | ||
"translation": "Trainee" | ||
}, | ||
{ | ||
"id": "time_period", | ||
"translation": "Time period" | ||
} | ||
] |
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 @@ | ||
[] |
Oops, something went wrong.