Skip to content

Commit

Permalink
[conf] sphinxnotes-any 3.0a3
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Sep 9, 2024
1 parent 3919398 commit c87d9ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
13 changes: 6 additions & 7 deletions _conf/schemas.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Definition of any domain's object schemas.
# See also https://sphinx.silverrainz.me/any/.

from sphinxnotes.any import Schema, Field as F
from sphinxnotes.any.schema import YearIndexer, MonthIndexer
from sphinxnotes.any.api import Schema, Field as F, by_year, by_month, PathIndexer

by_year = YearIndexer()
by_month = MonthIndexer()
by_hyphen = PathIndexer('-', 1)
by_slash = PathIndexer('/', 1)

_schemas = [
Schema('friend',
Expand All @@ -31,7 +30,7 @@
Schema('artwork',
name=F(ref=True),
attrs={
'id': F(uniq=True, ref=True, required=True),
'id': F(uniq=True, ref=True, required=True, indexers=[by_hyphen]),
'date': F(ref=True, indexers=[by_year, by_month]),
'medium': F(ref=True, form=F.Forms.WORDS),
'size': F(ref=True),
Expand Down Expand Up @@ -88,7 +87,7 @@
Schema('term',
name=F(ref=True, required=True, form=F.Forms.LINES),
attrs={
'field': F(ref=True),
'field': F(ref=True, indexers=[by_slash]),
'enwiki': F(),
'zhwiki': F(),
},
Expand Down Expand Up @@ -141,7 +140,7 @@
Schema('dev',
name=F(ref=True, required=True),
attrs={
'id': F(uniq=True, ref=True, required=True),
'id': F(uniq=True, ref=True, required=True, indexers=[by_hyphen]),
'type': F(ref=True),
'web': F(),
'man': F(),
Expand Down
3 changes: 2 additions & 1 deletion _templates/artwork.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
:编号: {{ id }}
:编号: :artwork.id+by-path:`{{ id }} <{{ id }}>`

:日期: :artwork.date+by-month:`{{ date }} <{{ date }}>`
{% if size %}:尺幅: :artwork.size:`{{ size }} <{{ size }}>`{% endif %}
:媒介: {% for m in medium %}:artwork.medium:`{{ m }} <{{ m }}>` {% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion collections/art-works/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Art Works
======== ================================
索引类型 索引页面
-------- --------------------------------
编号 :ref:`any-artwork.id`
编号 :ref:`any-artwork.id+by-path`
媒介 :ref:`any-artwork.medium`
尺幅 :ref:`any-artwork.size`
:ref:`any-artwork.date+by-year`
Expand Down

0 comments on commit c87d9ff

Please sign in to comment.