Skip to content

Commit 4686f71

Browse files
committed
Implement Clojure recipe
1 parent 56e0907 commit 4686f71

File tree

3 files changed

+98
-9
lines changed

3 files changed

+98
-9
lines changed

src/recipe/lang/Clojure.c

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@
44
* File Authors : Aoran Zeng <[email protected]>
55
* Contributors : Nil Null <[email protected]>
66
* Created On : <2023-09-10>
7-
* Last Modified : <2024-08-09>
7+
* Last Modified : <2025-07-14>
88
* ------------------------------------------------------------*/
99

10+
#include "rawstr4c.h"
11+
1012
/**
11-
* @update 2023-09-10
12-
* @note 不太好换,且用户可能不多,我们暂时只给用户提供文档
13+
* @update 2025-07-14
1314
*/
1415
static Source_t pl_clojure_sources[] =
1516
{
16-
{&UpstreamProvider, NULL},
17-
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/help/clojars/"},
18-
{&Ustc, "https://mirrors.ustc.edu.cn/help/clojars.html"}
17+
{&UpstreamProvider, NULL, NULL},
18+
{&MirrorZ, "https://mirrors.cernet.edu.cn/clojars/", DelegateToMirror},
19+
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/clojars/", DelegateToMirror},
20+
{&Nju, "https://mirror.nju.edu.cn/clojars/", DelegateToMirror},
21+
{&Nyist, "https://mirror.nyist.edu.cn/clojars/", DelegateToMirror},
22+
{&Ustc, "https://mirrors.ustc.edu.cn/clojars/", DelegateToMirror},
23+
{&Iscas, "https://mirror.iscas.ac.cn/clojars/", DelegateToMirror}
1924
};
2025
def_sources_n(pl_clojure);
2126

@@ -25,11 +30,43 @@ pl_clojure_setsrc (char *option)
2530
{
2631
chsrc_yield_source_and_confirm (pl_clojure);
2732

28-
chsrc_note2 ("抱歉,Clojure换源较复杂,可手动查阅并换源:");
29-
p(source.url);
33+
if (chsrc_in_local_mode())
34+
{
35+
chsrc_note2 ("请在项目根目录中的 project.clj 中手动添加 :mirrors 关键字:");
36+
char *config = xy_str_gsub (RAWSTR_pl_project_clj, "@url@", source.url);
37+
println (config);
38+
}
39+
else
40+
{
41+
chsrc_note2 ("请在 ~/.lein/projfiles.clj 中手动添加 :mirrors 关键字:");
42+
char *config = xy_str_gsub (RAWSTR_pl_projfiles_clj, "@url@", source.url);
43+
println (config);
44+
}
3045

3146
chsrc_determine_chgtype (ChgType_Manual);
3247
chsrc_conclude (&source);
3348
}
3449

35-
def_target_s (pl_clojure);
50+
51+
/**
52+
* chsrc ls clojure
53+
*/
54+
Feature_t
55+
pl_clojure_feat (char *option)
56+
{
57+
Feature_t f = {0};
58+
59+
f.can_get = false;
60+
f.can_reset = false;
61+
62+
f.cap_locally = CanNot;
63+
f.cap_locally_explain = NULL;
64+
f.can_english = false;
65+
66+
f.can_user_define = true;
67+
68+
f.note = NULL;
69+
return f;
70+
}
71+
72+
def_target_sf(pl_clojure);

src/recipe/lang/rawstr4c.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#pragma once
2+
3+
/**
4+
* Generated by rawstr4c v0.1.0.2-2025/07/14
5+
*
6+
* Date: 2025-07-14T23:22:27.033387+08:00
7+
*/
8+
9+
char RAWSTR_pl_project_clj[] = "\050\144\145\146\160\162\157\152\145\143\164\040\155\171\141\160\160\040\042\061\056\060\056\060\042\012\040\040\040\072\144\145\163\143\162\151\160\164\151\157\156\040\042\115\171\040\101\160\160\154\151\143\141\164\151\157\156\042\012\040\040\040\072\144\145\160\145\156\144\145\156\143\151\145\163\040\133\133\154\151\142\061\040\042\061\056\060\056\060\042\135\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\133\154\151\142\062\040\042\062\056\060\056\060\042\135\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\133\154\151\142\063\040\042\063\056\060\056\060\042\135\135\012\040\040\040\072\155\151\162\162\157\162\163\040\173\042\143\154\157\152\141\162\163\042\040\173\072\156\141\155\145\040\042\155\151\162\162\157\162\042\012\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\072\165\162\154\040\042\100\165\162\154\100\042\175\175\012\040\040\040\072\155\141\151\156\040\154\145\151\156\151\156\147\145\156\056\167\145\142\051\012";
10+
11+
char RAWSTR_pl_projfiles_clj[] = "\072\165\163\145\162\040\173\072\162\145\160\157\163\151\164\157\162\151\145\163\040\133\133\042\143\154\157\152\141\162\163\042\040\173\072\165\162\154\040\042\100\165\162\154\100\042\175\135\135\012\040\040\040\040\040\040\040\073\073\040\157\164\150\145\162\040\072\165\163\145\162\040\160\162\157\146\151\154\145\040\163\145\164\164\151\156\147\163\012\040\040\040\040\040\040\175\012";
12+

src/recipe/lang/rawstr4c.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!-- -----------------------------------------------------------
2+
! SPDX-License-Identifier: GPL-3.0-or-later
3+
! -------------------------------------------------------------
4+
! Config Type : rawstr4c (Markdown)
5+
! Config Authors: Aoran Zeng <[email protected]>
6+
! Contributors : Nil Null <[email protected]>
7+
! Created On : <2025-07-14>
8+
! Last Modified : <2025-07-14>
9+
! ---------------------------------------------------------- -->
10+
11+
# rawstr4c input
12+
13+
- prefix = `RAWSTR_pl`
14+
- output = `:global-variable-only-header`
15+
- translate = `:oct`
16+
17+
## Clojar
18+
19+
### project.clj
20+
21+
```clojure
22+
(defproject myapp "1.0.0"
23+
:description "My Application"
24+
:dependencies [[lib1 "1.0.0"]
25+
[lib2 "2.0.0"]
26+
[lib3 "3.0.0"]]
27+
:mirrors {"clojars" {:name "mirror"
28+
:url "@url@"}}
29+
:main leiningen.web)
30+
```
31+
32+
33+
34+
### projfiles.clj
35+
36+
```clojure
37+
:user {:repositories [["clojars" {:url "@url@"}]]
38+
;; other :user profile settings
39+
}
40+
```

0 commit comments

Comments
 (0)