From dfe69e6cbe00fd7cb26ba5116c3fd78064462a68 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Tue, 10 Dec 2024 22:27:28 +0300 Subject: Auto-commit 2024-12-10 --- content/go/_index.md | 4 ++++ content/go/workflow.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ hugo.toml | 12 ++++++++++++ layouts/go/single.htm | 4 ++++ 4 files changed, 72 insertions(+) create mode 100644 content/go/_index.md create mode 100644 content/go/workflow.md create mode 100644 layouts/go/single.htm diff --git a/content/go/_index.md b/content/go/_index.md new file mode 100644 index 0000000..24fe9d4 --- /dev/null +++ b/content/go/_index.md @@ -0,0 +1,4 @@ ++++ +title = "Мои go модули" ++++ + diff --git a/content/go/workflow.md b/content/go/workflow.md new file mode 100644 index 0000000..220d14b --- /dev/null +++ b/content/go/workflow.md @@ -0,0 +1,52 @@ ++++ +title = "Workflow" +name = "workflow" +repository = "https://git.neonxp.ru/workflow.git" +description = "Простой конечный автомат для Go" +outputs = ["html", "go"] ++++ + +# Workflow for Go + +[![GoDoc](https://godoc.org/github.com/neonxp/workflow?status.svg)](https://godoc.org/github.com/neonxp/workflow) + +Simple state machine. Inspired by [Symfony Workflow](https://github.com/symfony/workflow). + +## Example usage + +```go +o := new(ObjectImplementedPlaceer) + +w := NewWorkflow("Start") +w.AddTransition("Start", "A") +w.AddTransition("Start", "B") +w.AddTransition("A", "C") +w.AddTransition("B", "D") +w.AddTransition( "C", "D") +w.AddTransition("C", "Finish") +w.AddTransition("D", "Finish") + +w.Can(o, "A") // == nil +w.Can(o, "C") // == ErrTransitionNotFound + +w.GetEnabledTransitions(o) // []Place{"A", "B"} +w.Apply(o, "A") // o now at "A" place +w.GetEnabledTransitions(o) // []Place{"C"} + +w.DumpToDot() // See above +``` + +## Dump result + +``` +digraph { + Start[color="blue"] + Start -> A[label="Start → A"]; + Start -> B[label="Start → B"]; + A -> C[label="A → C"]; + B -> D[label="B → D"]; + C -> D[label="C → D"]; + C -> Finish[label="C → Finish"]; + D -> Finish[label="D → Finish"]; +} +``` \ No newline at end of file diff --git a/hugo.toml b/hugo.toml index c972cf5..28a7647 100644 --- a/hugo.toml +++ b/hugo.toml @@ -116,6 +116,18 @@ page = ["html"] home = ["html"] section = ["html", "rss"] +[mediaTypes] + [mediaTypes.'text/html'] + suffixes = ['html'] + [mediaTypes.'text/gohtml'] + suffixes = ['htm'] +[outputFormats] + [outputFormats.html] + mediaType = 'text/html' + [outputFormats.go] + mediaType = 'text/gohtml' + + [pagination] disableAliases = false pagerSize = 10 diff --git a/layouts/go/single.htm b/layouts/go/single.htm new file mode 100644 index 0000000..2a5ea73 --- /dev/null +++ b/layouts/go/single.htm @@ -0,0 +1,4 @@ + + + + \ No newline at end of file -- cgit v1.2.3